Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 84.5% → 99.8%
Time: 16.7s
Alternatives: 18
Speedup: 2.3×

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 18 alternatives:

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

Initial Program: 84.5% 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, 1.0× speedup?

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

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 1.12 \cdot 10^{+24}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{z\_m}}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 1.12e24

    1. Initial program 83.1%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\cosh x \cdot \left(y \cdot \frac{1}{z}\right)}}{x} \]
      6. div-invN/A

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

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

        \[\leadsto \frac{\color{blue}{\cosh x} \cdot \frac{y}{z}}{x} \]
      9. /-lowering-/.f6493.5

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

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

    if 1.12e24 < z

    1. Initial program 87.6%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f6499.8

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

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

Alternative 2: 93.9% accurate, 0.5× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 2 \cdot 10^{+203}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{\cosh x}{x}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= (* (cosh x) (/ y x)) 2e+203)
    (*
     (/ y x)
     (/
      (fma (fma x x 0.0) (fma x (fma x 0.041666666666666664 0.0) 0.5) 1.0)
      z_m))
    (* y (/ (/ (cosh x) x) z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if ((cosh(x) * (y / x)) <= 2e+203) {
		tmp = (y / x) * (fma(fma(x, x, 0.0), fma(x, fma(x, 0.041666666666666664, 0.0), 0.5), 1.0) / z_m);
	} else {
		tmp = y * ((cosh(x) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (Float64(cosh(x) * Float64(y / x)) <= 2e+203)
		tmp = Float64(Float64(y / x) * Float64(fma(fma(x, x, 0.0), fma(x, fma(x, 0.041666666666666664, 0.0), 0.5), 1.0) / z_m));
	else
		tmp = Float64(y * Float64(Float64(cosh(x) / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], 2e+203], N[(N[(y / x), $MachinePrecision] * N[(N[(N[(x * x + 0.0), $MachinePrecision] * N[(x * N[(x * 0.041666666666666664 + 0.0), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 2 \cdot 10^{+203}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{z\_m}\\

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


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

    1. Initial program 94.6%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6488.7

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified88.7%

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

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

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

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

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

        \[\leadsto \frac{y}{x} \cdot \color{blue}{\frac{\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1}{z}} \]
    7. Applied egg-rr89.3%

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

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

    1. Initial program 65.1%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f6499.9

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

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

Alternative 3: 77.7% accurate, 0.7× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z\_m} \leq 10^{-98}:\\ \;\;\;\;\frac{y}{z\_m \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{z\_m}}{x}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= (/ (* (cosh x) (/ y x)) z_m) 1e-98)
    (/ y (* z_m x))
    (/
     (/
      (*
       y
       (fma
        (* x x)
        (fma
         (* x x)
         (fma (* x x) 0.001388888888888889 0.041666666666666664)
         0.5)
        1.0))
      z_m)
     x))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (((cosh(x) * (y / x)) / z_m) <= 1e-98) {
		tmp = y / (z_m * x);
	} else {
		tmp = ((y * fma((x * x), fma((x * x), fma((x * x), 0.001388888888888889, 0.041666666666666664), 0.5), 1.0)) / z_m) / x;
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (Float64(Float64(cosh(x) * Float64(y / x)) / z_m) <= 1e-98)
		tmp = Float64(y / Float64(z_m * x));
	else
		tmp = Float64(Float64(Float64(y * fma(Float64(x * x), fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, 0.041666666666666664), 0.5), 1.0)) / z_m) / x);
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], 1e-98], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 9.99999999999999939e-99

    1. Initial program 93.4%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6458.7

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified58.7%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot x}} \]
      3. *-lowering-*.f6458.7

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

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

    if 9.99999999999999939e-99 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z)

    1. Initial program 73.9%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f6493.8

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

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

      \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    7. Simplified89.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{720} + \frac{1}{24}\right)\right) + \frac{1}{2}\right) + 1\right)}{z}}{x}} \]
    9. Applied egg-rr95.9%

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot 0.001388888888888889, 0.041666666666666664\right), 0\right), 0.5\right), 1\right) \cdot y}{z}}{x}} \]
    10. Taylor expanded in x around 0

      \[\leadsto \frac{\frac{\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)} \cdot y}{z}}{x} \]
    11. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right) + 1\right)} \cdot y}{z}}{x} \]
      2. accelerator-lowering-fma.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{24} + \frac{1}{720} \cdot {x}^{2}, \frac{1}{2}\right)}, 1\right) \cdot y}{z}}{x} \]
      7. unpow2N/A

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{720}, \frac{1}{24}\right), \frac{1}{2}\right), 1\right) \cdot y}{z}}{x} \]
      13. *-lowering-*.f6495.9

        \[\leadsto \frac{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right) \cdot y}{z}}{x} \]
    12. Simplified95.9%

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

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

Alternative 4: 91.5% accurate, 0.7× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z\_m} \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{x}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= (/ (* (cosh x) (/ y x)) z_m) 2e+305)
    (/
     (/ (* y (fma x (* x (fma (* x x) 0.041666666666666664 0.5)) 1.0)) x)
     z_m)
    (*
     y
     (/
      (/
       (fma
        (* x x)
        (fma
         x
         (* x (fma (* x x) 0.001388888888888889 0.041666666666666664))
         0.5)
        1.0)
       x)
      z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (((cosh(x) * (y / x)) / z_m) <= 2e+305) {
		tmp = ((y * fma(x, (x * fma((x * x), 0.041666666666666664, 0.5)), 1.0)) / x) / z_m;
	} else {
		tmp = y * ((fma((x * x), fma(x, (x * fma((x * x), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (Float64(Float64(cosh(x) * Float64(y / x)) / z_m) <= 2e+305)
		tmp = Float64(Float64(Float64(y * fma(x, Float64(x * fma(Float64(x * x), 0.041666666666666664, 0.5)), 1.0)) / x) / z_m);
	else
		tmp = Float64(y * Float64(Float64(fma(Float64(x * x), fma(x, Float64(x * fma(Float64(x * x), 0.001388888888888889, 0.041666666666666664)), 0.5), 1.0) / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], 2e+305], N[(N[(N[(y * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y * N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z\_m} \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z\_m}\\

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


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

    1. Initial program 94.7%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6489.0

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified89.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)} \cdot \frac{y}{x}}{z} \]
    6. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{\frac{y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)}{x}}}{z} \]
    7. Step-by-step derivation
      1. *-rgt-identityN/A

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

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

        \[\leadsto \frac{\frac{y \cdot 1 + \left(\color{blue}{\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot y} + \frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x}}{z} \]
      4. distribute-rgt-outN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y \cdot \left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}{x}}}{z} \]
    8. Simplified89.0%

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

    if 1.9999999999999999e305 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z)

    1. Initial program 63.5%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f64100.0

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

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

      \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    7. Simplified93.3%

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

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

Alternative 5: 91.3% accurate, 0.7× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 5 \cdot 10^{+204}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(0.001388888888888889 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), 1\right)}{x}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= (* (cosh x) (/ y x)) 5e+204)
    (*
     (/ y x)
     (/
      (fma (fma x x 0.0) (fma x (fma x 0.041666666666666664 0.0) 0.5) 1.0)
      z_m))
    (*
     y
     (/
      (/ (fma (* x x) (* x (* 0.001388888888888889 (* x (* x x)))) 1.0) x)
      z_m)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if ((cosh(x) * (y / x)) <= 5e+204) {
		tmp = (y / x) * (fma(fma(x, x, 0.0), fma(x, fma(x, 0.041666666666666664, 0.0), 0.5), 1.0) / z_m);
	} else {
		tmp = y * ((fma((x * x), (x * (0.001388888888888889 * (x * (x * x)))), 1.0) / x) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (Float64(cosh(x) * Float64(y / x)) <= 5e+204)
		tmp = Float64(Float64(y / x) * Float64(fma(fma(x, x, 0.0), fma(x, fma(x, 0.041666666666666664, 0.0), 0.5), 1.0) / z_m));
	else
		tmp = Float64(y * Float64(Float64(fma(Float64(x * x), Float64(x * Float64(0.001388888888888889 * Float64(x * Float64(x * x)))), 1.0) / x) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], 5e+204], N[(N[(y / x), $MachinePrecision] * N[(N[(N[(x * x + 0.0), $MachinePrecision] * N[(x * N[(x * 0.041666666666666664 + 0.0), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(0.001388888888888889 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq 5 \cdot 10^{+204}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{z\_m}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(0.001388888888888889 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), 1\right)}{x}}{z\_m}\\


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

    1. Initial program 94.6%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6488.8

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified88.8%

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

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

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

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

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

        \[\leadsto \frac{y}{x} \cdot \color{blue}{\frac{\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1}{z}} \]
    7. Applied egg-rr89.4%

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

    if 5.00000000000000008e204 < (*.f64 (cosh.f64 x) (/.f64 y x))

    1. Initial program 64.8%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f6499.9

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

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

      \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    7. Simplified93.4%

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

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

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, \frac{1}{720} \cdot {x}^{\color{blue}{\left(2 \cdot 2\right)}}, 1\right)}{x}}{z} \]
      2. pow-sqrN/A

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

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

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, \color{blue}{{x}^{2} \cdot \left(\frac{1}{720} \cdot {x}^{2}\right)}, 1\right)}{x}}{z} \]
      5. unpow2N/A

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

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

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

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \color{blue}{\left(\frac{1}{720} \cdot \left({x}^{2} \cdot x\right)\right)}, 1\right)}{x}}{z} \]
      9. unpow2N/A

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(\frac{1}{720} \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right)\right), 1\right)}{x}}{z} \]
      10. unpow3N/A

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

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, \color{blue}{x \cdot \left(\frac{1}{720} \cdot {x}^{3}\right)}, 1\right)}{x}}{z} \]
      12. *-lowering-*.f64N/A

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \color{blue}{\left(\frac{1}{720} \cdot {x}^{3}\right)}, 1\right)}{x}}{z} \]
      13. cube-multN/A

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(\frac{1}{720} \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)}\right), 1\right)}{x}}{z} \]
      14. unpow2N/A

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

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(\frac{1}{720} \cdot \color{blue}{\left(x \cdot {x}^{2}\right)}\right), 1\right)}{x}}{z} \]
      16. unpow2N/A

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(\frac{1}{720} \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right), 1\right)}{x}}{z} \]
      17. *-lowering-*.f6493.4

        \[\leadsto y \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, x \cdot \left(0.001388888888888889 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right), 1\right)}{x}}{z} \]
    10. Simplified93.4%

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

Alternative 6: 89.8% accurate, 1.0× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq 0.00028:\\ \;\;\;\;\frac{\frac{y}{z\_m} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{x}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+48}:\\ \;\;\;\;y \cdot \frac{\cosh x}{z\_m \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{z\_m}}{x}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= x 0.00028)
    (/
     (*
      (/ y z_m)
      (fma x (* x (fma x (fma x 0.041666666666666664 0.0) 0.5)) 1.0))
     x)
    (if (<= x 1.25e+48)
      (* y (/ (cosh x) (* z_m x)))
      (/
       (/
        (*
         y
         (fma
          (* x x)
          (fma
           (* x x)
           (fma (* x x) 0.001388888888888889 0.041666666666666664)
           0.5)
          1.0))
        z_m)
       x)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (x <= 0.00028) {
		tmp = ((y / z_m) * fma(x, (x * fma(x, fma(x, 0.041666666666666664, 0.0), 0.5)), 1.0)) / x;
	} else if (x <= 1.25e+48) {
		tmp = y * (cosh(x) / (z_m * x));
	} else {
		tmp = ((y * fma((x * x), fma((x * x), fma((x * x), 0.001388888888888889, 0.041666666666666664), 0.5), 1.0)) / z_m) / x;
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (x <= 0.00028)
		tmp = Float64(Float64(Float64(y / z_m) * fma(x, Float64(x * fma(x, fma(x, 0.041666666666666664, 0.0), 0.5)), 1.0)) / x);
	elseif (x <= 1.25e+48)
		tmp = Float64(y * Float64(cosh(x) / Float64(z_m * x)));
	else
		tmp = Float64(Float64(Float64(y * fma(Float64(x * x), fma(Float64(x * x), fma(Float64(x * x), 0.001388888888888889, 0.041666666666666664), 0.5), 1.0)) / z_m) / x);
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[x, 0.00028], N[(N[(N[(y / z$95$m), $MachinePrecision] * N[(x * N[(x * N[(x * N[(x * 0.041666666666666664 + 0.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.25e+48], N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.001388888888888889 + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision] / x), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 0.00028:\\
\;\;\;\;\frac{\frac{y}{z\_m} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{x}\\

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

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


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

    1. Initial program 85.8%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6479.9

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified79.9%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)} \cdot \frac{y}{x}}{z} \]
    6. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \left(\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1\right) \cdot \color{blue}{\frac{y}{x \cdot z}} \]
      3. +-rgt-identityN/A

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

        \[\leadsto \color{blue}{\left(\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1\right) \cdot \frac{y}{x \cdot z + 0}} \]
    7. Applied egg-rr77.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right) \cdot \frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    8. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1\right) \cdot \frac{y}{z}}{x}} \]
    9. Applied egg-rr86.5%

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

    if 2.7999999999999998e-4 < x < 1.24999999999999993e48

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 1.24999999999999993e48 < x

    1. Initial program 75.9%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f64100.0

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

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

      \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto y \cdot \frac{\color{blue}{\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}}}{z} \]
    7. Simplified98.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{720} + \frac{1}{24}\right)\right) + \frac{1}{2}\right) + 1\right)}{z}}{x}} \]
    9. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot 0.001388888888888889, 0.041666666666666664\right), 0\right), 0.5\right), 1\right) \cdot y}{z}}{x}} \]
    10. Taylor expanded in x around 0

      \[\leadsto \frac{\frac{\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)} \cdot y}{z}}{x} \]
    11. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{720} \cdot {x}^{2}\right)\right) + 1\right)} \cdot y}{z}}{x} \]
      2. accelerator-lowering-fma.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{24} + \frac{1}{720} \cdot {x}^{2}, \frac{1}{2}\right)}, 1\right) \cdot y}{z}}{x} \]
      7. unpow2N/A

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{720}, \frac{1}{24}\right), \frac{1}{2}\right), 1\right) \cdot y}{z}}{x} \]
      13. *-lowering-*.f64100.0

        \[\leadsto \frac{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right) \cdot y}{z}}{x} \]
    12. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.00028:\\ \;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{x}\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+48}:\\ \;\;\;\;y \cdot \frac{\cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, 0.001388888888888889, 0.041666666666666664\right), 0.5\right), 1\right)}{z}}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 70.6% accurate, 2.1× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;x \leq 2.35 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{y}{z\_m}}{x}\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{+101}:\\ \;\;\;\;\frac{\frac{y}{x} \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), x \cdot \left(x \cdot 0.041666666666666664\right), 1\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.041666666666666664 \cdot \left(x \cdot \left(x \cdot x\right)\right)}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= x 2.35e-39)
    (/ (/ y z_m) x)
    (if (<= x 8.2e+101)
      (/
       (* (/ y x) (fma (fma x x 0.0) (* x (* x 0.041666666666666664)) 1.0))
       z_m)
      (* y (/ (* 0.041666666666666664 (* x (* x x))) z_m))))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (x <= 2.35e-39) {
		tmp = (y / z_m) / x;
	} else if (x <= 8.2e+101) {
		tmp = ((y / x) * fma(fma(x, x, 0.0), (x * (x * 0.041666666666666664)), 1.0)) / z_m;
	} else {
		tmp = y * ((0.041666666666666664 * (x * (x * x))) / z_m);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (x <= 2.35e-39)
		tmp = Float64(Float64(y / z_m) / x);
	elseif (x <= 8.2e+101)
		tmp = Float64(Float64(Float64(y / x) * fma(fma(x, x, 0.0), Float64(x * Float64(x * 0.041666666666666664)), 1.0)) / z_m);
	else
		tmp = Float64(y * Float64(Float64(0.041666666666666664 * Float64(x * Float64(x * x))) / z_m));
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[x, 2.35e-39], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 8.2e+101], N[(N[(N[(y / x), $MachinePrecision] * N[(N[(x * x + 0.0), $MachinePrecision] * N[(x * N[(x * 0.041666666666666664), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y * N[(N[(0.041666666666666664 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 2.35 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{+101}:\\
\;\;\;\;\frac{\frac{y}{x} \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), x \cdot \left(x \cdot 0.041666666666666664\right), 1\right)}{z\_m}\\

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


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

    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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6463.4

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified63.4%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. /-lowering-/.f6471.1

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

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

    if 2.3500000000000001e-39 < x < 8.1999999999999999e101

    1. Initial program 95.2%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6468.7

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified68.7%

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

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
    7. Step-by-step derivation
      1. unpow2N/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), x \cdot \color{blue}{\left(x \cdot \frac{1}{24}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      6. *-lowering-*.f6468.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), x \cdot \color{blue}{\left(x \cdot 0.041666666666666664\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
    8. Simplified68.2%

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{x \cdot \left(x \cdot 0.041666666666666664\right)}, 1\right) \cdot \frac{y}{x}}{z} \]

    if 8.1999999999999999e101 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x \cdot \color{blue}{\left(\left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) \cdot x\right)} + 1}{x \cdot z} \]
      5. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{24}, \frac{1}{2}\right), 1\right)}{x \cdot z} \]
      12. *-lowering-*.f6474.5

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.041666666666666664, 0.5\right), 1\right)}{x \cdot z} \]
    7. Simplified74.5%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{\frac{1}{24} \cdot {x}^{3}}{z}} \]
      2. /-lowering-/.f64N/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{1}{24} \cdot {x}^{3}}}{z} \]
      4. cube-multN/A

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

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

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

        \[\leadsto y \cdot \frac{\frac{1}{24} \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)}{z} \]
      8. *-lowering-*.f64100.0

        \[\leadsto y \cdot \frac{0.041666666666666664 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)}{z} \]
    10. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.35 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{y}{z}}{x}\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{+101}:\\ \;\;\;\;\frac{\frac{y}{x} \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), x \cdot \left(x \cdot 0.041666666666666664\right), 1\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.041666666666666664 \cdot \left(x \cdot \left(x \cdot x\right)\right)}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 70.5% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
t_0 := 0.041666666666666664 \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 0.00031:\\
\;\;\;\;\frac{\frac{y}{z\_m}}{x}\\

\mathbf{elif}\;x \leq 5.5 \cdot 10^{+99}:\\
\;\;\;\;\frac{\frac{y}{x} \cdot \left(x \cdot t\_0\right)}{z\_m}\\

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. /-lowering-/.f6472.2

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

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

    if 3.1e-4 < x < 5.5000000000000002e99

    1. Initial program 92.9%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6451.3

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(x \cdot \left(\frac{1}{24} \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)\right) \cdot \frac{y}{x}}{z} \]
      16. *-lowering-*.f6451.3

        \[\leadsto \frac{\left(x \cdot \left(0.041666666666666664 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)\right) \cdot \frac{y}{x}}{z} \]
    8. Simplified51.3%

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

    if 5.5000000000000002e99 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x \cdot \color{blue}{\left(\left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) \cdot x\right)} + 1}{x \cdot z} \]
      5. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{24}, \frac{1}{2}\right), 1\right)}{x \cdot z} \]
      12. *-lowering-*.f6474.5

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.041666666666666664, 0.5\right), 1\right)}{x \cdot z} \]
    7. Simplified74.5%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{\frac{1}{24} \cdot {x}^{3}}{z}} \]
      2. /-lowering-/.f64N/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{1}{24} \cdot {x}^{3}}}{z} \]
      4. cube-multN/A

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

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

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

        \[\leadsto y \cdot \frac{\frac{1}{24} \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)}{z} \]
      8. *-lowering-*.f64100.0

        \[\leadsto y \cdot \frac{0.041666666666666664 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)}{z} \]
    10. Simplified100.0%

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

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

Alternative 9: 89.5% accurate, 2.2× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq 6.7 \cdot 10^{-19}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z\_m} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{x}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= y 6.7e-19)
    (/
     (/ (* y (fma x (* x (fma (* x x) 0.041666666666666664 0.5)) 1.0)) x)
     z_m)
    (/
     (*
      (/ y z_m)
      (fma x (* x (fma x (fma x 0.041666666666666664 0.0) 0.5)) 1.0))
     x))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (y <= 6.7e-19) {
		tmp = ((y * fma(x, (x * fma((x * x), 0.041666666666666664, 0.5)), 1.0)) / x) / z_m;
	} else {
		tmp = ((y / z_m) * fma(x, (x * fma(x, fma(x, 0.041666666666666664, 0.0), 0.5)), 1.0)) / x;
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (y <= 6.7e-19)
		tmp = Float64(Float64(Float64(y * fma(x, Float64(x * fma(Float64(x * x), 0.041666666666666664, 0.5)), 1.0)) / x) / z_m);
	else
		tmp = Float64(Float64(Float64(y / z_m) * fma(x, Float64(x * fma(x, fma(x, 0.041666666666666664, 0.0), 0.5)), 1.0)) / x);
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[y, 6.7e-19], N[(N[(N[(y * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(N[(y / z$95$m), $MachinePrecision] * N[(x * N[(x * N[(x * N[(x * 0.041666666666666664 + 0.0), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 6.7 \cdot 10^{-19}:\\
\;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z\_m}\\

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


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

    1. Initial program 80.7%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6472.9

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified72.9%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)} \cdot \frac{y}{x}}{z} \]
    6. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{\frac{y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)}{x}}}{z} \]
    7. Step-by-step derivation
      1. *-rgt-identityN/A

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

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

        \[\leadsto \frac{\frac{y \cdot 1 + \left(\color{blue}{\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot y} + \frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x}}{z} \]
      4. distribute-rgt-outN/A

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

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

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

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

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

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

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

    if 6.69999999999999998e-19 < y

    1. Initial program 93.2%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6489.1

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified89.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)} \cdot \frac{y}{x}}{z} \]
    6. Step-by-step derivation
      1. associate-/l*N/A

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

        \[\leadsto \left(\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1\right) \cdot \color{blue}{\frac{y}{x \cdot z}} \]
      3. +-rgt-identityN/A

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

        \[\leadsto \color{blue}{\left(\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1\right) \cdot \frac{y}{x \cdot z + 0}} \]
    7. Applied egg-rr87.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right) \cdot \frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    8. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\left(\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{24} + 0\right) + \frac{1}{2}\right) + 1\right) \cdot \frac{y}{z}}{x}} \]
    9. Applied egg-rr95.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.7 \cdot 10^{-19}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 88.0% accurate, 2.3× speedup?

\[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq 4 \cdot 10^{+99}:\\ \;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{\mathsf{fma}\left(x, x \cdot 0.5, 1\right) \cdot \frac{1}{z\_m}}{x}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= y 4e+99)
    (/
     (/ (* y (fma x (* x (fma (* x x) 0.041666666666666664 0.5)) 1.0)) x)
     z_m)
    (* y (/ (* (fma x (* x 0.5) 1.0) (/ 1.0 z_m)) x)))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (y <= 4e+99) {
		tmp = ((y * fma(x, (x * fma((x * x), 0.041666666666666664, 0.5)), 1.0)) / x) / z_m;
	} else {
		tmp = y * ((fma(x, (x * 0.5), 1.0) * (1.0 / z_m)) / x);
	}
	return z_s * tmp;
}
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (y <= 4e+99)
		tmp = Float64(Float64(Float64(y * fma(x, Float64(x * fma(Float64(x * x), 0.041666666666666664, 0.5)), 1.0)) / x) / z_m);
	else
		tmp = Float64(y * Float64(Float64(fma(x, Float64(x * 0.5), 1.0) * Float64(1.0 / z_m)) / x));
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[y, 4e+99], N[(N[(N[(y * N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.041666666666666664 + 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y * N[(N[(N[(x * N[(x * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 / z$95$m), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+99}:\\
\;\;\;\;\frac{\frac{y \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.041666666666666664, 0.5\right), 1\right)}{x}}{z\_m}\\

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


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

    1. Initial program 83.0%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6475.1

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified75.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.041666666666666664, 0\right), 0.5\right), 1\right)} \cdot \frac{y}{x}}{z} \]
    6. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{\frac{y + {x}^{2} \cdot \left(\frac{1}{24} \cdot \left({x}^{2} \cdot y\right) + \frac{1}{2} \cdot y\right)}{x}}}{z} \]
    7. Step-by-step derivation
      1. *-rgt-identityN/A

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

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

        \[\leadsto \frac{\frac{y \cdot 1 + \left(\color{blue}{\left(\frac{1}{24} \cdot {x}^{2}\right) \cdot y} + \frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x}}{z} \]
      4. distribute-rgt-outN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y \cdot \left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right)\right)}{x}}}{z} \]
    8. Simplified87.5%

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

    if 3.9999999999999999e99 < y

    1. Initial program 89.5%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x} \cdot \cosh x}}{z} \]
      2. div-invN/A

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

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

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

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

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

        \[\leadsto y \cdot \frac{\color{blue}{\cosh x \cdot \frac{1}{x}}}{z} \]
      8. div-invN/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{\cosh x}{x}}}{z} \]
      10. cosh-lowering-cosh.f6499.9

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

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

      \[\leadsto y \cdot \color{blue}{\frac{\frac{1}{2} \cdot \frac{{x}^{2}}{z} + \frac{1}{z}}{x}} \]
    6. Step-by-step derivation
      1. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{\left(\color{blue}{x \cdot \left(\frac{1}{2} \cdot x\right)} + 1\right) \cdot \frac{1}{z}}{x} \]
      15. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{2}}, 1\right) \cdot \frac{1}{z}}{x} \]
      18. /-lowering-/.f6491.5

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot 0.5, 1\right) \cdot \color{blue}{\frac{1}{z}}}{x} \]
    7. Simplified91.5%

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

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

Alternative 11: 70.0% accurate, 3.4× speedup?

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

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

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. /-lowering-/.f6472.2

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

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

    if 3.1e-4 < x

    1. Initial program 78.7%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6469.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified69.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{24} \cdot \color{blue}{\left(x \cdot \left(x \cdot y\right)\right)}\right)}{z} \]
      14. *-lowering-*.f6482.6

        \[\leadsto \frac{x \cdot \left(0.041666666666666664 \cdot \left(x \cdot \color{blue}{\left(x \cdot y\right)}\right)\right)}{z} \]
    8. Simplified82.6%

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

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

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot \left(y \cdot \frac{1}{24}\right)\right)}}{z} \]
      5. +-rgt-identityN/A

        \[\leadsto \frac{x \cdot \left(\color{blue}{\left(x \cdot x + 0\right)} \cdot \left(y \cdot \frac{1}{24}\right)\right)}{z} \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{x \cdot \left(\color{blue}{\mathsf{fma}\left(x, x, 0\right)} \cdot \left(y \cdot \frac{1}{24}\right)\right)}{z} \]
      7. *-lowering-*.f6482.6

        \[\leadsto \frac{x \cdot \left(\mathsf{fma}\left(x, x, 0\right) \cdot \color{blue}{\left(y \cdot 0.041666666666666664\right)}\right)}{z} \]
    10. Applied egg-rr82.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \left(\frac{1}{24} \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{z} \]
      9. *-lowering-*.f6485.7

        \[\leadsto \frac{y \cdot \left(0.041666666666666664 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right)}{z} \]
    13. Simplified85.7%

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

Alternative 12: 69.8% accurate, 3.4× speedup?

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

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

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. /-lowering-/.f6472.2

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

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

    if 3.1e-4 < x

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{\cosh x}{\color{blue}{x \cdot z}} \]
      9. *-lowering-*.f6473.8

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x \cdot \color{blue}{\left(\left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) \cdot x\right)} + 1}{x \cdot z} \]
      5. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{24}, \frac{1}{2}\right), 1\right)}{x \cdot z} \]
      12. *-lowering-*.f6469.1

        \[\leadsto y \cdot \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.041666666666666664, 0.5\right), 1\right)}{x \cdot z} \]
    7. Simplified69.1%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{\frac{1}{24} \cdot {x}^{3}}{z}} \]
      2. /-lowering-/.f64N/A

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

        \[\leadsto y \cdot \frac{\color{blue}{\frac{1}{24} \cdot {x}^{3}}}{z} \]
      4. cube-multN/A

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

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

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

        \[\leadsto y \cdot \frac{\frac{1}{24} \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)}{z} \]
      8. *-lowering-*.f6485.7

        \[\leadsto y \cdot \frac{0.041666666666666664 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)}{z} \]
    10. Simplified85.7%

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

Alternative 13: 68.6% accurate, 3.4× speedup?

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

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

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. /-lowering-/.f6472.2

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

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

    if 3.1e-4 < x

    1. Initial program 78.7%

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

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

        \[\leadsto \frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {x}^{2}\right) + 1\right)} \cdot \frac{y}{x}}{z} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right)} \cdot \frac{y}{x}}{z} \]
      3. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{{x}^{2} + 0}, \frac{1}{2} + \frac{1}{24} \cdot {x}^{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      4. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\frac{1}{24} \cdot {x}^{2} + \frac{1}{2}}, 1\right) \cdot \frac{y}{x}}{z} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{{x}^{2} \cdot \frac{1}{24}} + \frac{1}{2}, 1\right) \cdot \frac{y}{x}}{z} \]
      8. unpow2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{24}, \frac{1}{2}\right)}, 1\right) \cdot \frac{y}{x}}{z} \]
      11. +-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{24} + 0}, \frac{1}{2}\right), 1\right) \cdot \frac{y}{x}}{z} \]
      12. accelerator-lowering-fma.f6469.2

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.041666666666666664, 0\right)}, 0.5\right), 1\right) \cdot \frac{y}{x}}{z} \]
    5. Simplified69.2%

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

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

        \[\leadsto \color{blue}{\frac{1}{24} \cdot \frac{{x}^{3} \cdot y}{z}} \]
      2. /-lowering-/.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{24} \cdot \frac{x \cdot \color{blue}{\left(x \cdot \left(x \cdot y\right)\right)}}{z} \]
      10. *-lowering-*.f6482.6

        \[\leadsto 0.041666666666666664 \cdot \frac{x \cdot \left(x \cdot \color{blue}{\left(x \cdot y\right)}\right)}{z} \]
    8. Simplified82.6%

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

Alternative 14: 59.2% accurate, 4.4× speedup?

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

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

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{x}} \]
      5. /-lowering-/.f6472.2

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

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

    if 3.1e-4 < x

    1. Initial program 78.7%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + \frac{1}{2} \cdot {x}^{2}}{x} \cdot \frac{y}{z}} \]
      8. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y + \left(\frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x \cdot z}} \]
    5. Simplified53.4%

      \[\leadsto \color{blue}{\frac{y \cdot \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, x, 0\right), 1\right)}{\mathsf{fma}\left(x, z, 0\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 \color{blue}{\frac{1}{2} \cdot \frac{x \cdot y}{z}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(x \cdot \frac{y}{z}\right)} \]
      4. /-lowering-/.f6435.8

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(x \cdot y\right) \cdot \frac{1}{2}}}{z} \]
      6. *-lowering-*.f6448.1

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

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

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

Alternative 15: 57.2% accurate, 4.4× speedup?

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

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

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


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

    1. Initial program 85.8%

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{z} \]
    5. Simplified64.8%

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

    if 3.1e-4 < x

    1. Initial program 78.7%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + \frac{1}{2} \cdot {x}^{2}}{x} \cdot \frac{y}{z}} \]
      8. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y + \left(\frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x \cdot z}} \]
    5. Simplified53.4%

      \[\leadsto \color{blue}{\frac{y \cdot \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, x, 0\right), 1\right)}{\mathsf{fma}\left(x, z, 0\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 \color{blue}{\frac{1}{2} \cdot \frac{x \cdot y}{z}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(x \cdot \frac{y}{z}\right)} \]
      4. /-lowering-/.f6435.8

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(x \cdot y\right) \cdot \frac{1}{2}}}{z} \]
      6. *-lowering-*.f6448.1

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

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

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

Alternative 16: 57.0% accurate, 4.6× speedup?

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

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

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot x}} \]
      3. *-lowering-*.f6464.8

        \[\leadsto \frac{y}{\color{blue}{z \cdot x}} \]
    7. Applied egg-rr64.8%

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

    if 3.1e-4 < x

    1. Initial program 78.7%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + \frac{1}{2} \cdot {x}^{2}}{x} \cdot \frac{y}{z}} \]
      8. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y + \left(\frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x \cdot z}} \]
    5. Simplified53.4%

      \[\leadsto \color{blue}{\frac{y \cdot \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, x, 0\right), 1\right)}{\mathsf{fma}\left(x, z, 0\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 \color{blue}{\frac{1}{2} \cdot \frac{x \cdot y}{z}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(x \cdot \frac{y}{z}\right)} \]
      4. /-lowering-/.f6435.8

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(x \cdot y\right) \cdot \frac{1}{2}}}{z} \]
      6. *-lowering-*.f6448.1

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

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

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

Alternative 17: 55.2% accurate, 4.6× speedup?

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

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

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


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

    1. Initial program 85.8%

      \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
      2. +-rgt-identityN/A

        \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
      3. accelerator-lowering-fma.f6464.8

        \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
    5. Simplified64.8%

      \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

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

        \[\leadsto \frac{y}{\color{blue}{z \cdot x}} \]
      3. *-lowering-*.f6464.8

        \[\leadsto \frac{y}{\color{blue}{z \cdot x}} \]
    7. Applied egg-rr64.8%

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

    if 3.1e-4 < x

    1. Initial program 78.7%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + \frac{1}{2} \cdot {x}^{2}}{x} \cdot \frac{y}{z}} \]
      8. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y + \left(\frac{1}{2} \cdot y\right) \cdot {x}^{2}}{x \cdot z}} \]
    5. Simplified53.4%

      \[\leadsto \color{blue}{\frac{y \cdot \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, x, 0\right), 1\right)}{\mathsf{fma}\left(x, z, 0\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 \color{blue}{\frac{1}{2} \cdot \frac{x \cdot y}{z}} \]
      2. associate-/l*N/A

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

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(x \cdot \frac{y}{z}\right)} \]
      4. /-lowering-/.f6435.8

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

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

Alternative 18: 48.8% accurate, 7.5× speedup?

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

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

    \[\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 \color{blue}{\frac{y}{x \cdot z}} \]
    2. +-rgt-identityN/A

      \[\leadsto \frac{y}{\color{blue}{x \cdot z + 0}} \]
    3. accelerator-lowering-fma.f6450.7

      \[\leadsto \frac{y}{\color{blue}{\mathsf{fma}\left(x, z, 0\right)}} \]
  5. Simplified50.7%

    \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, z, 0\right)}} \]
  6. Step-by-step derivation
    1. +-rgt-identityN/A

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

      \[\leadsto \frac{y}{\color{blue}{z \cdot x}} \]
    3. *-lowering-*.f6450.7

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

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

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

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

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

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

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


\end{array}
\end{array}

Reproduce

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