Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 85.3% → 99.8%
Time: 12.0s
Alternatives: 13
Speedup: 6.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 85.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 96.7%

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

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

    1. Initial program 69.0%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{\frac{\cosh x \cdot y}{x}}{z} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\cosh x \cdot y}{\color{blue}{x \cdot z}} \]
      3. *-commutativeN/A

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

        \[\leadsto y \cdot \color{blue}{\frac{\cosh x}{x \cdot z}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\cosh x}{x \cdot z} \cdot \color{blue}{y} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\cosh x}{x \cdot z}\right), \color{blue}{y}\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{\cosh x}{x}}{z}\right), y\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{\cosh x}{x}\right), z\right), y\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cosh x, x\right), z\right), y\right) \]
      10. cosh-lowering-cosh.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cosh.f64}\left(x\right), x\right), z\right), y\right) \]
    4. Applied egg-rr99.9%

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

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

Alternative 2: 93.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 84.3%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6494.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified94.4%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6488.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified88.7%

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)}{z}\right), x\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right), x\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right)\right), x\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right), z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right), z\right)\right), x\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      11. *-lowering-*.f6488.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
    9. Applied egg-rr88.7%

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

    if 2.50000000000000004e-195 < z

    1. Initial program 86.5%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{\frac{\cosh x \cdot y}{x}}{z} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\cosh x \cdot y}{\color{blue}{x \cdot z}} \]
      3. *-commutativeN/A

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

        \[\leadsto y \cdot \color{blue}{\frac{\cosh x}{x \cdot z}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\cosh x}{x \cdot z} \cdot \color{blue}{y} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\cosh x}{x \cdot z}\right), \color{blue}{y}\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{\cosh x}{x}}{z}\right), y\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{\cosh x}{x}\right), z\right), y\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cosh x, x\right), z\right), y\right) \]
      10. cosh-lowering-cosh.f6499.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cosh.f64}\left(x\right), x\right), z\right), y\right) \]
    4. Applied egg-rr99.0%

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

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

Alternative 3: 92.6% accurate, 3.6× speedup?

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

\\
\begin{array}{l}
t_0 := 0.041666666666666664 + \left(x\_m \cdot x\_m\right) \cdot 0.001388888888888889\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{y\_m \cdot \left(1 + \left(x\_m \cdot x\_m\right) \cdot \left(0.5 + x\_m \cdot \left(x\_m \cdot t\_0\right)\right)\right)}{z}}{x\_m}\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2e20

    1. Initial program 86.3%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6495.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified95.5%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left({x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(x \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right) \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right) \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{24}, \left(\frac{1}{720} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{24}, \left({x}^{2} \cdot \frac{1}{720}\right)\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left({x}^{2}\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      16. *-lowering-*.f6492.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{720}\right)\right)\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified92.0%

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

    if 2e20 < z

    1. Initial program 82.1%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{\frac{\cosh x \cdot y}{x}}{z} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\cosh x \cdot y}{\color{blue}{x \cdot z}} \]
      3. *-commutativeN/A

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

        \[\leadsto y \cdot \color{blue}{\frac{\cosh x}{x \cdot z}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\cosh x}{x \cdot z} \cdot \color{blue}{y} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\cosh x}{x \cdot z}\right), \color{blue}{y}\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{\cosh x}{x}}{z}\right), y\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{\cosh x}{x}\right), z\right), y\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cosh x, x\right), z\right), y\right) \]
      10. cosh-lowering-cosh.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cosh.f64}\left(x\right), x\right), z\right), y\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\color{blue}{\left(\frac{1 + {x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)}{x}\right)}, z\right), y\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right), x\right), z\right), y\right) \]
    7. Simplified94.2%

      \[\leadsto \frac{\color{blue}{\frac{1 + \left(x \cdot x\right) \cdot \left(0.5 + x \cdot \left(x \cdot \left(0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\right)\right)}{x}}}{z} \cdot y \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \left(\frac{1}{24} + \left(x \cdot x\right) \cdot \frac{1}{720}\right)\right)\right)}{z \cdot x}\right), y\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \left(\frac{1}{24} + \left(x \cdot x\right) \cdot \frac{1}{720}\right)\right)\right)}{z}}{x}\right), y\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \left(\frac{1}{24} + \left(x \cdot x\right) \cdot \frac{1}{720}\right)\right)\right)}{z}\right), x\right), y\right) \]
    9. Applied egg-rr94.1%

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

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

Alternative 4: 91.3% accurate, 3.6× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 22500000:\\
\;\;\;\;\frac{y\_m \cdot \frac{1 + x\_m \cdot \left(x\_m \cdot \left(0.5 + x\_m \cdot \left(x\_m \cdot 0.041666666666666664\right)\right)\right)}{z}}{x\_m}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.25e7

    1. Initial program 86.0%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6495.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified95.4%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6488.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified88.1%

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)}{z}\right), x\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right), x\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right)\right), x\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right), z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right), z\right)\right), x\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      11. *-lowering-*.f6488.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
    9. Applied egg-rr88.1%

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

    if 2.25e7 < z

    1. Initial program 83.1%

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \frac{\frac{\cosh x \cdot y}{x}}{z} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\cosh x \cdot y}{\color{blue}{x \cdot z}} \]
      3. *-commutativeN/A

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

        \[\leadsto y \cdot \color{blue}{\frac{\cosh x}{x \cdot z}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\cosh x}{x \cdot z} \cdot \color{blue}{y} \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\cosh x}{x \cdot z}\right), \color{blue}{y}\right) \]
      7. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{\cosh x}{x}}{z}\right), y\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{\cosh x}{x}\right), z\right), y\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\cosh x, x\right), z\right), y\right) \]
      10. cosh-lowering-cosh.f6499.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{cosh.f64}\left(x\right), x\right), z\right), y\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\color{blue}{\left(\frac{1 + {x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)}{x}\right)}, z\right), y\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right)\right), x\right), z\right), y\right) \]
    7. Simplified94.5%

      \[\leadsto \frac{\color{blue}{\frac{1 + \left(x \cdot x\right) \cdot \left(0.5 + x \cdot \left(x \cdot \left(0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\right)\right)}{x}}}{z} \cdot y \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \left(\frac{1}{24} + \left(x \cdot x\right) \cdot \frac{1}{720}\right)\right)\right)}{z \cdot x}\right), y\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \left(\frac{1}{24} + \left(x \cdot x\right) \cdot \frac{1}{720}\right)\right)\right)}{z}}{x}\right), y\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \left(\frac{1}{24} + \left(x \cdot x\right) \cdot \frac{1}{720}\right)\right)\right)}{z}\right), x\right), y\right) \]
    9. Applied egg-rr94.4%

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

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

Alternative 5: 92.2% accurate, 4.5× speedup?

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

\\
\begin{array}{l}
t_0 := y\_m \cdot \left(1 + \left(0.5 + x\_m \cdot \left(x\_m \cdot 0.041666666666666664\right)\right) \cdot \left(x\_m \cdot x\_m\right)\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2000000:\\
\;\;\;\;\frac{\frac{t\_0}{x\_m}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{z}}{x\_m}\\


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

    1. Initial program 82.5%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)\right), x\right), z\right) \]
    5. Simplified90.3%

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

    if 2e6 < y

    1. Initial program 97.7%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified99.9%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6489.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified89.4%

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

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

Alternative 6: 90.0% accurate, 4.5× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 + x\_m \cdot \left(x\_m \cdot 0.041666666666666664\right)\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.2 \cdot 10^{+191}:\\
\;\;\;\;\frac{\frac{y\_m \cdot \left(1 + t\_0 \cdot \left(x\_m \cdot x\_m\right)\right)}{x\_m}}{z}\\

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


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

    1. Initial program 84.7%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)\right), x\right), z\right) \]
    5. Simplified89.6%

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

    if 1.19999999999999993e191 < y

    1. Initial program 93.4%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6499.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified99.8%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6499.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified99.8%

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)}{z}\right), x\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right), x\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right)\right), x\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right), z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right), z\right)\right), x\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      11. *-lowering-*.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
    9. Applied egg-rr99.9%

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

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

Alternative 7: 88.7% accurate, 4.5× speedup?

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

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

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


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

    1. Initial program 85.6%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6461.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, x\right), z\right) \]
    5. Simplified61.7%

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

    if 3.00000000000000018e-118 < x

    1. Initial program 84.5%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified99.9%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6488.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified88.3%

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)}{z}\right), x\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right), x\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \left(\frac{1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)}{z}\right)\right), x\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\left(1 + \left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right), z\right)\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(x \cdot x\right) \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right), z\right)\right), x\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
      11. *-lowering-*.f6489.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right)\right), z\right)\right), x\right) \]
    9. Applied egg-rr89.4%

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

Alternative 8: 88.6% accurate, 5.3× speedup?

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

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

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


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

    1. Initial program 86.7%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6466.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, x\right), z\right) \]
    5. Simplified66.4%

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

    if 2.2000000000000002 < x

    1. Initial program 80.3%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified100.0%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified82.9%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(\frac{1}{24} \cdot {x}^{4}\right)}, y\right), z\right), x\right) \]
    9. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{24} \cdot {x}^{\left(2 \cdot 2\right)}\right), y\right), z\right), x\right) \]
      2. pow-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{24} \cdot \left({x}^{2} \cdot {x}^{2}\right)\right), y\right), z\right), x\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot {x}^{2}\right), y\right), z\right), x\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot \left(x \cdot x\right)\right), y\right), z\right), x\right) \]
      5. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\left(\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot x\right) \cdot x\right), y\right), z\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(x \cdot \left(\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot x\right)\right), y\right), z\right), x\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot x\right)\right), y\right), z\right), x\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot \left({x}^{2} \cdot x\right)\right)\right), y\right), z\right), x\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right), y\right), z\right), x\right) \]
      10. unpow3N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot {x}^{3}\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\frac{1}{24}, \left({x}^{3}\right)\right)\right), y\right), z\right), x\right) \]
      12. cube-multN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\frac{1}{24}, \left(x \cdot \left(x \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\frac{1}{24}, \left(x \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(x, \left({x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(x, \left(x \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      16. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right), y\right), z\right), x\right) \]
    10. Simplified82.9%

      \[\leadsto \frac{\frac{\color{blue}{\left(x \cdot \left(0.041666666666666664 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)} \cdot y}{z}}{x} \]
    11. Taylor expanded in x around 0

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{1}{24} \cdot \frac{{x}^{4} \cdot y}{z}\right)}, x\right) \]
    12. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{24} \cdot \left({x}^{4} \cdot \frac{y}{z}\right)\right), x\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{24} \cdot \left({x}^{\left(2 \cdot 2\right)} \cdot \frac{y}{z}\right)\right), x\right) \]
      3. pow-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{24} \cdot \left(\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{y}{z}\right)\right), x\right) \]
      4. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{24} \cdot \left({x}^{2} \cdot \left({x}^{2} \cdot \frac{y}{z}\right)\right)\right), x\right) \]
      5. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{24} \cdot \left({x}^{2} \cdot \frac{{x}^{2} \cdot y}{z}\right)\right), x\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \left({x}^{2} \cdot \frac{{x}^{2} \cdot y}{z}\right)\right), x\right) \]
      7. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \left({x}^{2} \cdot \left({x}^{2} \cdot \frac{y}{z}\right)\right)\right), x\right) \]
      8. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \left(\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{y}{z}\right)\right), x\right) \]
      9. pow-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \left({x}^{\left(2 \cdot 2\right)} \cdot \frac{y}{z}\right)\right), x\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \left({x}^{4} \cdot \frac{y}{z}\right)\right), x\right) \]
      11. associate-/l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \left(\frac{{x}^{4} \cdot y}{z}\right)\right), x\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{24}, \mathsf{/.f64}\left(\left({x}^{4} \cdot y\right), z\right)\right), x\right) \]
    13. Simplified82.9%

      \[\leadsto \frac{\color{blue}{0.041666666666666664 \cdot \frac{y \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}{z}}}{x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 86.2% accurate, 6.7× speedup?

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

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

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


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

    1. Initial program 86.7%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6466.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, x\right), z\right) \]
    5. Simplified66.4%

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

    if 2.2000000000000002 < x

    1. Initial program 80.3%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified100.0%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}, y\right), z\right), x\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({x}^{2}\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)\right), y\right), z\right), x\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot {x}^{2}\right)\right)\right)\right), y\right), z\right), x\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{1}{24} \cdot \left(x \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      7. associate-*r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(\left(\frac{1}{24} \cdot x\right) \cdot x\right)\right)\right)\right), y\right), z\right), x\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(\frac{1}{24} \cdot x\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
      11. *-lowering-*.f6482.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{24}\right)\right)\right)\right)\right), y\right), z\right), x\right) \]
    7. Simplified82.9%

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

      \[\leadsto \color{blue}{\frac{1}{24} \cdot \frac{{x}^{3} \cdot y}{z}} \]
    9. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \frac{1}{24} \cdot \left({x}^{3} \cdot \color{blue}{\frac{y}{z}}\right) \]
      2. *-commutativeN/A

        \[\leadsto \frac{1}{24} \cdot \left(\frac{y}{z} \cdot \color{blue}{{x}^{3}}\right) \]
      3. associate-*l*N/A

        \[\leadsto \left(\frac{1}{24} \cdot \frac{y}{z}\right) \cdot \color{blue}{{x}^{3}} \]
      4. associate-*r/N/A

        \[\leadsto \frac{\frac{1}{24} \cdot y}{z} \cdot {\color{blue}{x}}^{3} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y \cdot \frac{1}{24}}{z} \cdot {x}^{3} \]
      6. associate-/l*N/A

        \[\leadsto \left(y \cdot \frac{\frac{1}{24}}{z}\right) \cdot {\color{blue}{x}}^{3} \]
      7. metadata-evalN/A

        \[\leadsto \left(y \cdot \frac{\frac{1}{24} \cdot 1}{z}\right) \cdot {x}^{3} \]
      8. associate-*r/N/A

        \[\leadsto \left(y \cdot \left(\frac{1}{24} \cdot \frac{1}{z}\right)\right) \cdot {x}^{3} \]
      9. associate-*l*N/A

        \[\leadsto y \cdot \color{blue}{\left(\left(\frac{1}{24} \cdot \frac{1}{z}\right) \cdot {x}^{3}\right)} \]
      10. unpow3N/A

        \[\leadsto y \cdot \left(\left(\frac{1}{24} \cdot \frac{1}{z}\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{x}\right)\right) \]
      11. unpow2N/A

        \[\leadsto y \cdot \left(\left(\frac{1}{24} \cdot \frac{1}{z}\right) \cdot \left({x}^{2} \cdot x\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto y \cdot \left(\left(\left(\frac{1}{24} \cdot \frac{1}{z}\right) \cdot {x}^{2}\right) \cdot \color{blue}{x}\right) \]
      13. associate-*l*N/A

        \[\leadsto y \cdot \left(\left(\frac{1}{24} \cdot \left(\frac{1}{z} \cdot {x}^{2}\right)\right) \cdot x\right) \]
      14. associate-*l/N/A

        \[\leadsto y \cdot \left(\left(\frac{1}{24} \cdot \frac{1 \cdot {x}^{2}}{z}\right) \cdot x\right) \]
      15. *-lft-identityN/A

        \[\leadsto y \cdot \left(\left(\frac{1}{24} \cdot \frac{{x}^{2}}{z}\right) \cdot x\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\left(\frac{1}{24} \cdot \frac{{x}^{2}}{z}\right) \cdot x\right)}\right) \]
      17. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(\frac{\frac{1}{24} \cdot {x}^{2}}{z} \cdot x\right)\right) \]
      18. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(y, \left(\frac{\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot x}{\color{blue}{z}}\right)\right) \]
      19. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(\left(\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot x\right), \color{blue}{z}\right)\right) \]
    10. Simplified79.9%

      \[\leadsto \color{blue}{y \cdot \frac{0.041666666666666664 \cdot \left(x \cdot \left(x \cdot x\right)\right)}{z}} \]
    11. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{1}{24} \cdot \left(x \cdot \left(x \cdot x\right)\right)}{z} \cdot \color{blue}{y} \]
      2. associate-/l*N/A

        \[\leadsto \left(\frac{1}{24} \cdot \frac{x \cdot \left(x \cdot x\right)}{z}\right) \cdot y \]
      3. associate-*l*N/A

        \[\leadsto \frac{1}{24} \cdot \color{blue}{\left(\frac{x \cdot \left(x \cdot x\right)}{z} \cdot y\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \color{blue}{\left(\frac{x \cdot \left(x \cdot x\right)}{z} \cdot y\right)}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(\frac{x \cdot \left(x \cdot x\right)}{z}\right), \color{blue}{y}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(x \cdot \left(x \cdot x\right)\right), z\right), y\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot x\right)\right), z\right), y\right)\right) \]
      8. *-lowering-*.f6479.9%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right), z\right), y\right)\right) \]
    12. Applied egg-rr79.9%

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

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

Alternative 10: 66.1% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 86.7%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6466.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, x\right), z\right) \]
    5. Simplified66.4%

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

    if 1.3999999999999999 < x

    1. Initial program 80.3%

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

      \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot \frac{{x}^{2} \cdot y}{z} + \frac{y}{z}}{x}} \]
    4. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \left({x}^{2} \cdot \frac{y}{z}\right) + \frac{y}{z}}{x} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\left(\frac{1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{z} + \frac{y}{z}}{x} \]
      3. distribute-lft1-inN/A

        \[\leadsto \frac{\left(\frac{1}{2} \cdot {x}^{2} + 1\right) \cdot \frac{y}{z}}{x} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\left(1 + \frac{1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{z}}{x} \]
      5. associate-/l*N/A

        \[\leadsto \left(1 + \frac{1}{2} \cdot {x}^{2}\right) \cdot \color{blue}{\frac{\frac{y}{z}}{x}} \]
      6. +-commutativeN/A

        \[\leadsto \left(\frac{1}{2} \cdot {x}^{2} + 1\right) \cdot \frac{\color{blue}{\frac{y}{z}}}{x} \]
      7. associate-/l/N/A

        \[\leadsto \left(\frac{1}{2} \cdot {x}^{2} + 1\right) \cdot \frac{y}{\color{blue}{x \cdot z}} \]
      8. distribute-rgt1-inN/A

        \[\leadsto \frac{y}{x \cdot z} + \color{blue}{\left(\frac{1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{x \cdot z}} \]
      9. associate-*r/N/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{\left(\frac{1}{2} \cdot {x}^{2}\right) \cdot y}{\color{blue}{x \cdot z}} \]
      10. *-commutativeN/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{\left({x}^{2} \cdot \frac{1}{2}\right) \cdot y}{x \cdot z} \]
      11. associate-*r*N/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{{x}^{2} \cdot \left(\frac{1}{2} \cdot y\right)}{\color{blue}{x} \cdot z} \]
      12. unpow2N/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{\left(x \cdot x\right) \cdot \left(\frac{1}{2} \cdot y\right)}{x \cdot z} \]
      13. associate-*l*N/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{x \cdot \left(x \cdot \left(\frac{1}{2} \cdot y\right)\right)}{\color{blue}{x} \cdot z} \]
      14. *-commutativeN/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{x \cdot \left(\left(\frac{1}{2} \cdot y\right) \cdot x\right)}{x \cdot z} \]
      15. times-fracN/A

        \[\leadsto \frac{y}{x \cdot z} + \frac{x}{x} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot y\right) \cdot x}{z}} \]
      16. *-inversesN/A

        \[\leadsto \frac{y}{x \cdot z} + 1 \cdot \frac{\color{blue}{\left(\frac{1}{2} \cdot y\right) \cdot x}}{z} \]
      17. associate-*l/N/A

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

        \[\leadsto \frac{y}{x \cdot z} + 1 \cdot \left(\left(\frac{1}{2} \cdot \frac{y}{z}\right) \cdot x\right) \]
    5. Simplified27.8%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x \cdot y}{z}} \]
    7. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\left(\frac{x \cdot y}{z}\right)}\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\left(x \cdot y\right), \color{blue}{z}\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\left(y \cdot x\right), z\right)\right) \]
      4. *-lowering-*.f6438.8%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, x\right), z\right)\right) \]
    8. Simplified38.8%

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

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

Alternative 11: 54.6% accurate, 10.7× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.05 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x\_m}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.05e17

    1. Initial program 86.1%

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

        \[\leadsto \frac{\frac{y}{x} \cdot \cosh x}{z} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{y \cdot \frac{\cosh x}{z}}{\color{blue}{x}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot \frac{\cosh x}{z}\right), \color{blue}{x}\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{y \cdot \cosh x}{z}\right), x\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\cosh x \cdot y}{z}\right), x\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\cosh x \cdot y\right), z\right), x\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\cosh x, y\right), z\right), x\right) \]
      9. cosh-lowering-cosh.f6495.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{cosh.f64}\left(x\right), y\right), z\right), x\right) \]
    3. Simplified95.4%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y}{z}\right)}, x\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f6453.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, z\right), x\right) \]
    7. Simplified53.9%

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

    if 1.05e17 < z

    1. Initial program 82.6%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot z}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(y, \color{blue}{\left(x \cdot z\right)}\right) \]
      2. *-lowering-*.f6452.4%

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \color{blue}{z}\right)\right) \]
    5. Simplified52.4%

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

Alternative 12: 51.0% accurate, 10.7× speedup?

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

\\
y\_s \cdot \left(x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 1.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{y\_m}{x\_m}}{z}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.5e17

    1. Initial program 86.1%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{y}{x}\right)}, z\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f6454.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(y, x\right), z\right) \]
    5. Simplified54.3%

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

    if 1.5e17 < z

    1. Initial program 82.6%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot z}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(y, \color{blue}{\left(x \cdot z\right)}\right) \]
      2. *-lowering-*.f6452.4%

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \color{blue}{z}\right)\right) \]
    5. Simplified52.4%

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

Alternative 13: 49.3% accurate, 21.4× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{y}{x \cdot z}} \]
  4. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(y, \color{blue}{\left(x \cdot z\right)}\right) \]
    2. *-lowering-*.f6451.9%

      \[\leadsto \mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \color{blue}{z}\right)\right) \]
  5. Simplified51.9%

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

Developer Target 1: 97.1% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024150 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctan from linear-1.19.1.3"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< y -2309451133843521/5000000000000000000000000000000000000000000000000000000000000000000) (* (/ (/ y z) x) (cosh x)) (if (< y 1038530535935153/1000000000000000000000000000000000000000000000000000000) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x)))))

  (/ (* (cosh x) (/ y x)) z))