Linear.Quaternion:$ctan from linear-1.19.1.3

Percentage Accurate: 85.2% → 99.1%
Time: 9.1s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 85.2% 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.1% 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.6 \cdot 10^{-113}:\\ \;\;\;\;\frac{\frac{\cosh x}{\frac{z_m}{y}}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \frac{z_m}{\cosh x}}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 1.6e-113)
    (/ (/ (cosh x) (/ z_m y)) x)
    (/ y (* x (/ z_m (cosh 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 (z_m <= 1.6e-113) {
		tmp = (cosh(x) / (z_m / y)) / x;
	} else {
		tmp = y / (x * (z_m / cosh(x)));
	}
	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.6d-113) then
        tmp = (cosh(x) / (z_m / y)) / x
    else
        tmp = y / (x * (z_m / cosh(x)))
    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.6e-113) {
		tmp = (Math.cosh(x) / (z_m / y)) / x;
	} else {
		tmp = y / (x * (z_m / Math.cosh(x)));
	}
	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.6e-113:
		tmp = (math.cosh(x) / (z_m / y)) / x
	else:
		tmp = y / (x * (z_m / math.cosh(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 (z_m <= 1.6e-113)
		tmp = Float64(Float64(cosh(x) / Float64(z_m / y)) / x);
	else
		tmp = Float64(y / Float64(x * Float64(z_m / cosh(x))));
	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.6e-113)
		tmp = (cosh(x) / (z_m / y)) / x;
	else
		tmp = y / (x * (z_m / cosh(x)));
	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.6e-113], N[(N[(N[Cosh[x], $MachinePrecision] / N[(z$95$m / y), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(y / N[(x * N[(z$95$m / N[Cosh[x], $MachinePrecision]), $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}\;z_m \leq 1.6 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{\cosh x}{\frac{z_m}{y}}}{x}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 67.0% 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 1.3 \cdot 10^{-75}:\\ \;\;\;\;\frac{y}{z_m \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x}{z_m} \cdot \frac{y}{x}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= x 1.3e-75) (/ y (* z_m x)) (* (/ (cosh x) z_m) (/ y 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 <= 1.3e-75) {
		tmp = y / (z_m * x);
	} else {
		tmp = (cosh(x) / z_m) * (y / x);
	}
	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 <= 1.3d-75) then
        tmp = y / (z_m * x)
    else
        tmp = (cosh(x) / z_m) * (y / x)
    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 <= 1.3e-75) {
		tmp = y / (z_m * x);
	} else {
		tmp = (Math.cosh(x) / z_m) * (y / x);
	}
	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 <= 1.3e-75:
		tmp = y / (z_m * x)
	else:
		tmp = (math.cosh(x) / z_m) * (y / 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 <= 1.3e-75)
		tmp = Float64(y / Float64(z_m * x));
	else
		tmp = Float64(Float64(cosh(x) / z_m) * Float64(y / x));
	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 <= 1.3e-75)
		tmp = y / (z_m * x);
	else
		tmp = (cosh(x) / z_m) * (y / x);
	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, 1.3e-75], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / z$95$m), $MachinePrecision] * N[(y / 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}\;x \leq 1.3 \cdot 10^{-75}:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 99.1% 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 2 \cdot 10^{-113}:\\ \;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \frac{z_m}{\cosh x}}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 2e-113)
    (/ (* y (/ (cosh x) x)) z_m)
    (/ y (* x (/ z_m (cosh 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 (z_m <= 2e-113) {
		tmp = (y * (cosh(x) / x)) / z_m;
	} else {
		tmp = y / (x * (z_m / cosh(x)));
	}
	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 <= 2d-113) then
        tmp = (y * (cosh(x) / x)) / z_m
    else
        tmp = y / (x * (z_m / cosh(x)))
    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 <= 2e-113) {
		tmp = (y * (Math.cosh(x) / x)) / z_m;
	} else {
		tmp = y / (x * (z_m / Math.cosh(x)));
	}
	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 <= 2e-113:
		tmp = (y * (math.cosh(x) / x)) / z_m
	else:
		tmp = y / (x * (z_m / math.cosh(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 (z_m <= 2e-113)
		tmp = Float64(Float64(y * Float64(cosh(x) / x)) / z_m);
	else
		tmp = Float64(y / Float64(x * Float64(z_m / cosh(x))));
	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 <= 2e-113)
		tmp = (y * (cosh(x) / x)) / z_m;
	else
		tmp = y / (x * (z_m / cosh(x)));
	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, 2e-113], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(y / N[(x * N[(z$95$m / N[Cosh[x], $MachinePrecision]), $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}\;z_m \leq 2 \cdot 10^{-113}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z_m}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 96.0% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z_s \cdot \frac{y}{x \cdot \frac{z_m}{\cosh x}} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m) :precision binary64 (* z_s (/ y (* x (/ z_m (cosh 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 / (x * (z_m / cosh(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 / (x * (z_m / cosh(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 / (x * (z_m / Math.cosh(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 / (x * (z_m / math.cosh(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(x * Float64(z_m / cosh(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 / (x * (z_m / cosh(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[(x * N[(z$95$m / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
z_s \cdot \frac{y}{x \cdot \frac{z_m}{\cosh x}}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 72.0% accurate, 4.6× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ \begin{array}{l} t_0 := \frac{\frac{z_m}{x}}{y}\\ z_s \cdot \begin{array}{l} \mathbf{if}\;z_m \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{\frac{y}{x} \cdot t_0 + z_m \cdot 0.5}{z_m \cdot t_0}\\ \mathbf{elif}\;z_m \leq 6.9 \cdot 10^{+109}:\\ \;\;\;\;\frac{y + x \cdot \left(y \cdot \left(x \cdot 0.5\right)\right)}{z_m \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{x \cdot y}{z_m}\\ \end{array} \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (let* ((t_0 (/ (/ z_m x) y)))
   (*
    z_s
    (if (<= z_m 1.6e-114)
      (/ (+ (* (/ y x) t_0) (* z_m 0.5)) (* z_m t_0))
      (if (<= z_m 6.9e+109)
        (/ (+ y (* x (* y (* x 0.5)))) (* z_m x))
        (+ (/ 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 t_0 = (z_m / x) / y;
	double tmp;
	if (z_m <= 1.6e-114) {
		tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0);
	} else if (z_m <= 6.9e+109) {
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
	} else {
		tmp = (y / (z_m * x)) + (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) :: t_0
    real(8) :: tmp
    t_0 = (z_m / x) / y
    if (z_m <= 1.6d-114) then
        tmp = (((y / x) * t_0) + (z_m * 0.5d0)) / (z_m * t_0)
    else if (z_m <= 6.9d+109) then
        tmp = (y + (x * (y * (x * 0.5d0)))) / (z_m * x)
    else
        tmp = (y / (z_m * x)) + (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 t_0 = (z_m / x) / y;
	double tmp;
	if (z_m <= 1.6e-114) {
		tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0);
	} else if (z_m <= 6.9e+109) {
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
	} else {
		tmp = (y / (z_m * x)) + (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):
	t_0 = (z_m / x) / y
	tmp = 0
	if z_m <= 1.6e-114:
		tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0)
	elif z_m <= 6.9e+109:
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x)
	else:
		tmp = (y / (z_m * x)) + (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)
	t_0 = Float64(Float64(z_m / x) / y)
	tmp = 0.0
	if (z_m <= 1.6e-114)
		tmp = Float64(Float64(Float64(Float64(y / x) * t_0) + Float64(z_m * 0.5)) / Float64(z_m * t_0));
	elseif (z_m <= 6.9e+109)
		tmp = Float64(Float64(y + Float64(x * Float64(y * Float64(x * 0.5)))) / Float64(z_m * x));
	else
		tmp = Float64(Float64(y / Float64(z_m * x)) + Float64(0.5 * Float64(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)
	t_0 = (z_m / x) / y;
	tmp = 0.0;
	if (z_m <= 1.6e-114)
		tmp = (((y / x) * t_0) + (z_m * 0.5)) / (z_m * t_0);
	elseif (z_m <= 6.9e+109)
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
	else
		tmp = (y / (z_m * x)) + (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_] := Block[{t$95$0 = N[(N[(z$95$m / x), $MachinePrecision] / y), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 1.6e-114], N[(N[(N[(N[(y / x), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(z$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 6.9e+109], N[(N[(y + N[(x * N[(y * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
\begin{array}{l}
t_0 := \frac{\frac{z_m}{x}}{y}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 1.6 \cdot 10^{-114}:\\
\;\;\;\;\frac{\frac{y}{x} \cdot t_0 + z_m \cdot 0.5}{z_m \cdot t_0}\\

\mathbf{elif}\;z_m \leq 6.9 \cdot 10^{+109}:\\
\;\;\;\;\frac{y + x \cdot \left(y \cdot \left(x \cdot 0.5\right)\right)}{z_m \cdot x}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 70.6% accurate, 6.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}\;z_m \leq 1.6 \cdot 10^{-113}:\\ \;\;\;\;\frac{y}{z_m} \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)\\ \mathbf{elif}\;z_m \leq 2.2 \cdot 10^{+109}:\\ \;\;\;\;\frac{y + x \cdot \left(y \cdot \left(x \cdot 0.5\right)\right)}{z_m \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{x \cdot y}{z_m}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 1.6e-113)
    (* (/ y z_m) (+ (* x 0.5) (/ 1.0 x)))
    (if (<= z_m 2.2e+109)
      (/ (+ y (* x (* y (* x 0.5)))) (* z_m x))
      (+ (/ 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 (z_m <= 1.6e-113) {
		tmp = (y / z_m) * ((x * 0.5) + (1.0 / x));
	} else if (z_m <= 2.2e+109) {
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
	} else {
		tmp = (y / (z_m * x)) + (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 (z_m <= 1.6d-113) then
        tmp = (y / z_m) * ((x * 0.5d0) + (1.0d0 / x))
    else if (z_m <= 2.2d+109) then
        tmp = (y + (x * (y * (x * 0.5d0)))) / (z_m * x)
    else
        tmp = (y / (z_m * x)) + (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 (z_m <= 1.6e-113) {
		tmp = (y / z_m) * ((x * 0.5) + (1.0 / x));
	} else if (z_m <= 2.2e+109) {
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
	} else {
		tmp = (y / (z_m * x)) + (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 z_m <= 1.6e-113:
		tmp = (y / z_m) * ((x * 0.5) + (1.0 / x))
	elif z_m <= 2.2e+109:
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x)
	else:
		tmp = (y / (z_m * x)) + (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 (z_m <= 1.6e-113)
		tmp = Float64(Float64(y / z_m) * Float64(Float64(x * 0.5) + Float64(1.0 / x)));
	elseif (z_m <= 2.2e+109)
		tmp = Float64(Float64(y + Float64(x * Float64(y * Float64(x * 0.5)))) / Float64(z_m * x));
	else
		tmp = Float64(Float64(y / Float64(z_m * x)) + Float64(0.5 * Float64(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 (z_m <= 1.6e-113)
		tmp = (y / z_m) * ((x * 0.5) + (1.0 / x));
	elseif (z_m <= 2.2e+109)
		tmp = (y + (x * (y * (x * 0.5)))) / (z_m * x);
	else
		tmp = (y / (z_m * x)) + (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[z$95$m, 1.6e-113], N[(N[(y / z$95$m), $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 2.2e+109], N[(N[(y + N[(x * N[(y * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * y), $MachinePrecision] / 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}\;z_m \leq 1.6 \cdot 10^{-113}:\\
\;\;\;\;\frac{y}{z_m} \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)\\

\mathbf{elif}\;z_m \leq 2.2 \cdot 10^{+109}:\\
\;\;\;\;\frac{y + x \cdot \left(y \cdot \left(x \cdot 0.5\right)\right)}{z_m \cdot x}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 65.2% accurate, 7.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}\;z_m \leq 7.1 \cdot 10^{+71}:\\ \;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z_m \cdot x} + 0.5 \cdot \left(x \cdot \frac{y}{z_m}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 7.1e+71)
    (/ (* y (+ (* x 0.5) (/ 1.0 x))) z_m)
    (+ (/ 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 (z_m <= 7.1e+71) {
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
	} else {
		tmp = (y / (z_m * x)) + (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 (z_m <= 7.1d+71) then
        tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z_m
    else
        tmp = (y / (z_m * x)) + (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 (z_m <= 7.1e+71) {
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
	} else {
		tmp = (y / (z_m * x)) + (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 z_m <= 7.1e+71:
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m
	else:
		tmp = (y / (z_m * x)) + (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 (z_m <= 7.1e+71)
		tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z_m);
	else
		tmp = Float64(Float64(y / Float64(z_m * x)) + 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 (z_m <= 7.1e+71)
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
	else
		tmp = (y / (z_m * x)) + (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[z$95$m, 7.1e+71], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(y / z$95$m), $MachinePrecision]), $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}\;z_m \leq 7.1 \cdot 10^{+71}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z_m}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 68.4% accurate, 7.1× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ \begin{array}{l} t_0 := \frac{y}{z_m \cdot x}\\ z_s \cdot \begin{array}{l} \mathbf{if}\;z_m \leq 2 \cdot 10^{-49}:\\ \;\;\;\;t_0 + 0.5 \cdot \frac{y}{\frac{z_m}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_0 + 0.5 \cdot \frac{x \cdot y}{z_m}\\ \end{array} \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (let* ((t_0 (/ y (* z_m x))))
   (*
    z_s
    (if (<= z_m 2e-49)
      (+ t_0 (* 0.5 (/ y (/ z_m x))))
      (+ t_0 (* 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 t_0 = y / (z_m * x);
	double tmp;
	if (z_m <= 2e-49) {
		tmp = t_0 + (0.5 * (y / (z_m / x)));
	} else {
		tmp = t_0 + (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) :: t_0
    real(8) :: tmp
    t_0 = y / (z_m * x)
    if (z_m <= 2d-49) then
        tmp = t_0 + (0.5d0 * (y / (z_m / x)))
    else
        tmp = t_0 + (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 t_0 = y / (z_m * x);
	double tmp;
	if (z_m <= 2e-49) {
		tmp = t_0 + (0.5 * (y / (z_m / x)));
	} else {
		tmp = t_0 + (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):
	t_0 = y / (z_m * x)
	tmp = 0
	if z_m <= 2e-49:
		tmp = t_0 + (0.5 * (y / (z_m / x)))
	else:
		tmp = t_0 + (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)
	t_0 = Float64(y / Float64(z_m * x))
	tmp = 0.0
	if (z_m <= 2e-49)
		tmp = Float64(t_0 + Float64(0.5 * Float64(y / Float64(z_m / x))));
	else
		tmp = Float64(t_0 + Float64(0.5 * Float64(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)
	t_0 = y / (z_m * x);
	tmp = 0.0;
	if (z_m <= 2e-49)
		tmp = t_0 + (0.5 * (y / (z_m / x)));
	else
		tmp = t_0 + (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_] := Block[{t$95$0 = N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 2e-49], N[(t$95$0 + N[(0.5 * N[(y / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.5 * N[(N[(x * y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
\begin{array}{l}
t_0 := \frac{y}{z_m \cdot x}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 2 \cdot 10^{-49}:\\
\;\;\;\;t_0 + 0.5 \cdot \frac{y}{\frac{z_m}{x}}\\

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


\end{array}
\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 64.0% accurate, 8.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}\;z_m \leq 1.8 \cdot 10^{+72}:\\ \;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z_m \cdot x}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 1.8e+72) (/ (* y (+ (* x 0.5) (/ 1.0 x))) z_m) (/ 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) {
	double tmp;
	if (z_m <= 1.8e+72) {
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
	} else {
		tmp = y / (z_m * x);
	}
	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.8d+72) then
        tmp = (y * ((x * 0.5d0) + (1.0d0 / x))) / z_m
    else
        tmp = y / (z_m * x)
    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.8e+72) {
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
	} else {
		tmp = y / (z_m * x);
	}
	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.8e+72:
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m
	else:
		tmp = y / (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 (z_m <= 1.8e+72)
		tmp = Float64(Float64(y * Float64(Float64(x * 0.5) + Float64(1.0 / x))) / z_m);
	else
		tmp = Float64(y / Float64(z_m * x));
	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.8e+72)
		tmp = (y * ((x * 0.5) + (1.0 / x))) / z_m;
	else
		tmp = y / (z_m * x);
	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.8e+72], N[(N[(y * N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;z_m \leq 1.8 \cdot 10^{+72}:\\
\;\;\;\;\frac{y \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)}{z_m}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 64.6% accurate, 8.2× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z_s \cdot \left(\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{y}{\frac{z_m}{x}}\right) \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (+ (/ y (* z_m x)) (* 0.5 (/ 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)) + (0.5 * (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)) + (0.5d0 * (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)) + (0.5 * (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)) + (0.5 * (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(Float64(y / Float64(z_m * x)) + Float64(0.5 * 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)) + (0.5 * (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[(N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
z_s \cdot \left(\frac{y}{z_m \cdot x} + 0.5 \cdot \frac{y}{\frac{z_m}{x}}\right)
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 56.7% accurate, 11.8× 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 1.45:\\ \;\;\;\;\frac{y}{z_m \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{z_m}\right)\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= x 1.45) (/ y (* z_m x)) (* 0.5 (* y (/ 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 <= 1.45) {
		tmp = y / (z_m * x);
	} else {
		tmp = 0.5 * (y * (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 <= 1.45d0) then
        tmp = y / (z_m * x)
    else
        tmp = 0.5d0 * (y * (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 <= 1.45) {
		tmp = y / (z_m * x);
	} else {
		tmp = 0.5 * (y * (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 <= 1.45:
		tmp = y / (z_m * x)
	else:
		tmp = 0.5 * (y * (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 <= 1.45)
		tmp = Float64(y / Float64(z_m * x));
	else
		tmp = Float64(0.5 * Float64(y * Float64(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 <= 1.45)
		tmp = y / (z_m * x);
	else
		tmp = 0.5 * (y * (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, 1.45], N[(y / N[(z$95$m * x), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y * N[(x / 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 1.45:\\
\;\;\;\;\frac{y}{z_m \cdot x}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 12: 50.4% accurate, 15.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 1.15 \cdot 10^{-63}:\\ \;\;\;\;\frac{\frac{y}{x}}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z_m \cdot x}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= y 1.15e-63) (/ (/ y x) z_m) (/ 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) {
	double tmp;
	if (y <= 1.15e-63) {
		tmp = (y / x) / z_m;
	} else {
		tmp = y / (z_m * x);
	}
	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 (y <= 1.15d-63) then
        tmp = (y / x) / z_m
    else
        tmp = y / (z_m * x)
    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 (y <= 1.15e-63) {
		tmp = (y / x) / z_m;
	} else {
		tmp = y / (z_m * x);
	}
	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 y <= 1.15e-63:
		tmp = (y / x) / z_m
	else:
		tmp = y / (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 <= 1.15e-63)
		tmp = Float64(Float64(y / x) / z_m);
	else
		tmp = Float64(y / Float64(z_m * x));
	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 (y <= 1.15e-63)
		tmp = (y / x) / z_m;
	else
		tmp = y / (z_m * x);
	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[y, 1.15e-63], N[(N[(y / x), $MachinePrecision] / z$95$m), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-63}:\\
\;\;\;\;\frac{\frac{y}{x}}{z_m}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 13: 56.3% accurate, 15.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}\;z_m \leq 100000000000:\\ \;\;\;\;\frac{\frac{y}{z_m}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z_m \cdot x}\\ \end{array} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m)
 :precision binary64
 (* z_s (if (<= z_m 100000000000.0) (/ (/ y z_m) x) (/ 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) {
	double tmp;
	if (z_m <= 100000000000.0) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y / (z_m * x);
	}
	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 <= 100000000000.0d0) then
        tmp = (y / z_m) / x
    else
        tmp = y / (z_m * x)
    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 <= 100000000000.0) {
		tmp = (y / z_m) / x;
	} else {
		tmp = y / (z_m * x);
	}
	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 <= 100000000000.0:
		tmp = (y / z_m) / x
	else:
		tmp = y / (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 (z_m <= 100000000000.0)
		tmp = Float64(Float64(y / z_m) / x);
	else
		tmp = Float64(y / Float64(z_m * x));
	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 <= 100000000000.0)
		tmp = (y / z_m) / x;
	else
		tmp = y / (z_m * x);
	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, 100000000000.0], N[(N[(y / z$95$m), $MachinePrecision] / x), $MachinePrecision], 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 \begin{array}{l}
\mathbf{if}\;z_m \leq 100000000000:\\
\;\;\;\;\frac{\frac{y}{z_m}}{x}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 14: 48.6% accurate, 21.4× 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 1 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
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Developer target: 97.0% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

  :herbie-target
  (if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))

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