Linear.Quaternion:$ctanh from linear-1.19.1.3

Percentage Accurate: 96.0% → 99.5%
Time: 9.2s
Alternatives: 12
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot \frac{\sin y}{y}}{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 12 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: 96.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ \begin{array}{l} t_0 := \frac{\sin y}{y}\\ z_s \cdot \begin{array}{l} \mathbf{if}\;z_m \leq 10^{+63}:\\ \;\;\;\;\frac{x}{\frac{z_m}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot t_0}{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 (/ (sin y) y)))
   (* z_s (if (<= z_m 1e+63) (/ x (/ z_m t_0)) (/ (* x 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 = sin(y) / y;
	double tmp;
	if (z_m <= 1e+63) {
		tmp = x / (z_m / t_0);
	} else {
		tmp = (x * 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 = sin(y) / y
    if (z_m <= 1d+63) then
        tmp = x / (z_m / t_0)
    else
        tmp = (x * 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 = Math.sin(y) / y;
	double tmp;
	if (z_m <= 1e+63) {
		tmp = x / (z_m / t_0);
	} else {
		tmp = (x * 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 = math.sin(y) / y
	tmp = 0
	if z_m <= 1e+63:
		tmp = x / (z_m / t_0)
	else:
		tmp = (x * 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(sin(y) / y)
	tmp = 0.0
	if (z_m <= 1e+63)
		tmp = Float64(x / Float64(z_m / t_0));
	else
		tmp = Float64(Float64(x * 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 = sin(y) / y;
	tmp = 0.0;
	if (z_m <= 1e+63)
		tmp = x / (z_m / t_0);
	else
		tmp = (x * 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[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, N[(z$95$s * If[LessEqual[z$95$m, 1e+63], N[(x / N[(z$95$m / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x * t$95$0), $MachinePrecision] / z$95$m), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;z_m \leq 10^{+63}:\\
\;\;\;\;\frac{x}{\frac{z_m}{t_0}}\\

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


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

    1. Initial program 96.9%

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
    4. Add Preprocessing

    if 1.00000000000000006e63 < z

    1. Initial program 99.9%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification98.0%

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

Alternative 2: 96.0% accurate, 0.5× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ \begin{array}{l} t_0 := \frac{\sin y}{y}\\ z_s \cdot \begin{array}{l} \mathbf{if}\;t_0 \leq 5 \cdot 10^{-223}:\\ \;\;\;\;\sin y \cdot \frac{\frac{x}{y}}{z_m}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{x}{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 (/ (sin y) y)))
   (* z_s (if (<= t_0 5e-223) (* (sin y) (/ (/ x y) z_m)) (* t_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 t_0 = sin(y) / y;
	double tmp;
	if (t_0 <= 5e-223) {
		tmp = sin(y) * ((x / y) / z_m);
	} else {
		tmp = t_0 * (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) :: t_0
    real(8) :: tmp
    t_0 = sin(y) / y
    if (t_0 <= 5d-223) then
        tmp = sin(y) * ((x / y) / z_m)
    else
        tmp = t_0 * (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 t_0 = Math.sin(y) / y;
	double tmp;
	if (t_0 <= 5e-223) {
		tmp = Math.sin(y) * ((x / y) / z_m);
	} else {
		tmp = t_0 * (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):
	t_0 = math.sin(y) / y
	tmp = 0
	if t_0 <= 5e-223:
		tmp = math.sin(y) * ((x / y) / z_m)
	else:
		tmp = t_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)
	t_0 = Float64(sin(y) / y)
	tmp = 0.0
	if (t_0 <= 5e-223)
		tmp = Float64(sin(y) * Float64(Float64(x / y) / z_m));
	else
		tmp = Float64(t_0 * 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)
	t_0 = sin(y) / y;
	tmp = 0.0;
	if (t_0 <= 5e-223)
		tmp = sin(y) * ((x / y) / z_m);
	else
		tmp = t_0 * (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_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, N[(z$95$s * If[LessEqual[t$95$0, 5e-223], N[(N[Sin[y], $MachinePrecision] * N[(N[(x / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / 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 := \frac{\sin y}{y}\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-223}:\\
\;\;\;\;\sin y \cdot \frac{\frac{x}{y}}{z_m}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (sin.f64 y) y) < 5.00000000000000024e-223

    1. Initial program 96.1%

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

        \[\leadsto \color{blue}{1 \cdot \frac{x \cdot \frac{\sin y}{y}}{z}} \]
      2. metadata-eval96.1%

        \[\leadsto \color{blue}{\frac{-1}{-1}} \cdot \frac{x \cdot \frac{\sin y}{y}}{z} \]
      3. times-frac96.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot \frac{\sin y}{y}\right)}{-1 \cdot z}} \]
      4. neg-mul-196.1%

        \[\leadsto \frac{\color{blue}{-x \cdot \frac{\sin y}{y}}}{-1 \cdot z} \]
      5. distribute-lft-neg-out96.1%

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot \frac{\sin y}{y}}}{-1 \cdot z} \]
      6. associate-*r/96.1%

        \[\leadsto \frac{\color{blue}{\frac{\left(-x\right) \cdot \sin y}{y}}}{-1 \cdot z} \]
      7. associate-*l/96.2%

        \[\leadsto \frac{\color{blue}{\frac{-x}{y} \cdot \sin y}}{-1 \cdot z} \]
      8. *-commutative96.2%

        \[\leadsto \frac{\frac{-x}{y} \cdot \sin y}{\color{blue}{z \cdot -1}} \]
      9. times-frac95.1%

        \[\leadsto \color{blue}{\frac{\frac{-x}{y}}{z} \cdot \frac{\sin y}{-1}} \]
      10. remove-double-neg95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\left(-\left(-\frac{\sin y}{-1}\right)\right)} \]
      11. distribute-frac-neg95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\color{blue}{\frac{-\sin y}{-1}}\right) \]
      12. sin-neg95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\frac{\color{blue}{\sin \left(-y\right)}}{-1}\right) \]
      13. sin-neg95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\frac{\color{blue}{-\sin y}}{-1}\right) \]
      14. neg-mul-195.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\frac{\color{blue}{-1 \cdot \sin y}}{-1}\right) \]
      15. associate-/l*95.0%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\color{blue}{\frac{-1}{\frac{-1}{\sin y}}}\right) \]
      16. associate-/r/95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\color{blue}{\frac{-1}{-1} \cdot \sin y}\right) \]
      17. distribute-lft-neg-in95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\left(\left(-\frac{-1}{-1}\right) \cdot \sin y\right)} \]
      18. metadata-eval95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(\left(-\color{blue}{1}\right) \cdot \sin y\right) \]
      19. metadata-eval95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(\color{blue}{-1} \cdot \sin y\right) \]
      20. neg-mul-195.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\left(-\sin y\right)} \]
      21. sin-neg95.1%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\sin \left(-y\right)} \]
      22. *-commutative95.1%

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

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

    if 5.00000000000000024e-223 < (/.f64 (sin.f64 y) y)

    1. Initial program 97.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sin y}{y} \leq 5 \cdot 10^{-223}:\\ \;\;\;\;\sin y \cdot \frac{\frac{x}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 77.0% accurate, 0.9× 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.5 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+205}:\\ \;\;\;\;x \cdot \frac{\sin y}{z_m \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\sin y \cdot \frac{\frac{x}{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 (<= y 1.5e-8)
    (/ x z_m)
    (if (<= y 6e+205)
      (* x (/ (sin y) (* z_m y)))
      (* (sin y) (/ (/ 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 (y <= 1.5e-8) {
		tmp = x / z_m;
	} else if (y <= 6e+205) {
		tmp = x * (sin(y) / (z_m * y));
	} else {
		tmp = sin(y) * ((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 (y <= 1.5d-8) then
        tmp = x / z_m
    else if (y <= 6d+205) then
        tmp = x * (sin(y) / (z_m * y))
    else
        tmp = sin(y) * ((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 (y <= 1.5e-8) {
		tmp = x / z_m;
	} else if (y <= 6e+205) {
		tmp = x * (Math.sin(y) / (z_m * y));
	} else {
		tmp = Math.sin(y) * ((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 y <= 1.5e-8:
		tmp = x / z_m
	elif y <= 6e+205:
		tmp = x * (math.sin(y) / (z_m * y))
	else:
		tmp = math.sin(y) * ((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 (y <= 1.5e-8)
		tmp = Float64(x / z_m);
	elseif (y <= 6e+205)
		tmp = Float64(x * Float64(sin(y) / Float64(z_m * y)));
	else
		tmp = Float64(sin(y) * 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 (y <= 1.5e-8)
		tmp = x / z_m;
	elseif (y <= 6e+205)
		tmp = x * (sin(y) / (z_m * y));
	else
		tmp = sin(y) * ((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[y, 1.5e-8], N[(x / z$95$m), $MachinePrecision], If[LessEqual[y, 6e+205], N[(x * N[(N[Sin[y], $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(N[(x / y), $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}\;y \leq 1.5 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z_m}\\

\mathbf{elif}\;y \leq 6 \cdot 10^{+205}:\\
\;\;\;\;x \cdot \frac{\sin y}{z_m \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.49999999999999987e-8

    1. Initial program 98.1%

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

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

    if 1.49999999999999987e-8 < y < 5.9999999999999999e205

    1. Initial program 97.1%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative99.8%

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

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

    if 5.9999999999999999e205 < y

    1. Initial program 92.4%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. *-lft-identity92.4%

        \[\leadsto \color{blue}{1 \cdot \frac{x \cdot \frac{\sin y}{y}}{z}} \]
      2. metadata-eval92.4%

        \[\leadsto \color{blue}{\frac{-1}{-1}} \cdot \frac{x \cdot \frac{\sin y}{y}}{z} \]
      3. times-frac92.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(x \cdot \frac{\sin y}{y}\right)}{-1 \cdot z}} \]
      4. neg-mul-192.4%

        \[\leadsto \frac{\color{blue}{-x \cdot \frac{\sin y}{y}}}{-1 \cdot z} \]
      5. distribute-lft-neg-out92.4%

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot \frac{\sin y}{y}}}{-1 \cdot z} \]
      6. associate-*r/92.2%

        \[\leadsto \frac{\color{blue}{\frac{\left(-x\right) \cdot \sin y}{y}}}{-1 \cdot z} \]
      7. associate-*l/92.6%

        \[\leadsto \frac{\color{blue}{\frac{-x}{y} \cdot \sin y}}{-1 \cdot z} \]
      8. *-commutative92.6%

        \[\leadsto \frac{\frac{-x}{y} \cdot \sin y}{\color{blue}{z \cdot -1}} \]
      9. times-frac92.5%

        \[\leadsto \color{blue}{\frac{\frac{-x}{y}}{z} \cdot \frac{\sin y}{-1}} \]
      10. remove-double-neg92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\left(-\left(-\frac{\sin y}{-1}\right)\right)} \]
      11. distribute-frac-neg92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\color{blue}{\frac{-\sin y}{-1}}\right) \]
      12. sin-neg92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\frac{\color{blue}{\sin \left(-y\right)}}{-1}\right) \]
      13. sin-neg92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\frac{\color{blue}{-\sin y}}{-1}\right) \]
      14. neg-mul-192.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\frac{\color{blue}{-1 \cdot \sin y}}{-1}\right) \]
      15. associate-/l*92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\color{blue}{\frac{-1}{\frac{-1}{\sin y}}}\right) \]
      16. associate-/r/92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(-\color{blue}{\frac{-1}{-1} \cdot \sin y}\right) \]
      17. distribute-lft-neg-in92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\left(\left(-\frac{-1}{-1}\right) \cdot \sin y\right)} \]
      18. metadata-eval92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(\left(-\color{blue}{1}\right) \cdot \sin y\right) \]
      19. metadata-eval92.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \left(\color{blue}{-1} \cdot \sin y\right) \]
      20. neg-mul-192.5%

        \[\leadsto \frac{\frac{-x}{y}}{z} \cdot \color{blue}{\left(-\sin y\right)} \]
      21. sin-neg92.5%

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

        \[\leadsto \color{blue}{\sin \left(-y\right) \cdot \frac{\frac{-x}{y}}{z}} \]
    3. Simplified92.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+205}:\\ \;\;\;\;x \cdot \frac{\sin y}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\sin y \cdot \frac{\frac{x}{y}}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 77.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}\;y \leq 2.2 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\sin y}{z_m \cdot y}\\ \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 2.2e-8) (/ x z_m) (* x (/ (sin y) (* z_m y))))))
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 <= 2.2e-8) {
		tmp = x / z_m;
	} else {
		tmp = x * (sin(y) / (z_m * y));
	}
	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 <= 2.2d-8) then
        tmp = x / z_m
    else
        tmp = x * (sin(y) / (z_m * y))
    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 <= 2.2e-8) {
		tmp = x / z_m;
	} else {
		tmp = x * (Math.sin(y) / (z_m * y));
	}
	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 <= 2.2e-8:
		tmp = x / z_m
	else:
		tmp = x * (math.sin(y) / (z_m * y))
	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 <= 2.2e-8)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(x * Float64(sin(y) / Float64(z_m * y)));
	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 <= 2.2e-8)
		tmp = x / z_m;
	else
		tmp = x * (sin(y) / (z_m * y));
	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, 2.2e-8], N[(x / z$95$m), $MachinePrecision], N[(x * N[(N[Sin[y], $MachinePrecision] / N[(z$95$m * y), $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}\;y \leq 2.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.1%

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

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

    if 2.1999999999999998e-8 < y

    1. Initial program 95.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative93.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\sin y}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.6% accurate, 1.0× speedup?

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

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


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

    1. Initial program 96.9%

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
    3. Simplified97.5%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
    4. Add Preprocessing

    if 2e52 < z

    1. Initial program 99.9%

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

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

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

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

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

Alternative 6: 62.2% accurate, 5.9× 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 3.8 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(z_m \cdot \left(y \cdot 0.16666666666666666 + \frac{1}{y}\right)\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 (<= y 3.8e-24)
    (/ x z_m)
    (/ x (* y (* z_m (+ (* y 0.16666666666666666) (/ 1.0 y))))))))
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 <= 3.8e-24) {
		tmp = x / z_m;
	} else {
		tmp = x / (y * (z_m * ((y * 0.16666666666666666) + (1.0 / y))));
	}
	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 <= 3.8d-24) then
        tmp = x / z_m
    else
        tmp = x / (y * (z_m * ((y * 0.16666666666666666d0) + (1.0d0 / y))))
    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 <= 3.8e-24) {
		tmp = x / z_m;
	} else {
		tmp = x / (y * (z_m * ((y * 0.16666666666666666) + (1.0 / y))));
	}
	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 <= 3.8e-24:
		tmp = x / z_m
	else:
		tmp = x / (y * (z_m * ((y * 0.16666666666666666) + (1.0 / y))))
	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 <= 3.8e-24)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(x / Float64(y * Float64(z_m * Float64(Float64(y * 0.16666666666666666) + Float64(1.0 / y)))));
	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 <= 3.8e-24)
		tmp = x / z_m;
	else
		tmp = x / (y * (z_m * ((y * 0.16666666666666666) + (1.0 / y))));
	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, 3.8e-24], N[(x / z$95$m), $MachinePrecision], N[(x / N[(y * N[(z$95$m * N[(N[(y * 0.16666666666666666), $MachinePrecision] + N[(1.0 / y), $MachinePrecision]), $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}\;y \leq 3.8 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.0%

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

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

    if 3.80000000000000026e-24 < y

    1. Initial program 95.7%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative94.2%

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

      \[\leadsto \color{blue}{x \cdot \frac{\sin y}{y \cdot z}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*94.1%

        \[\leadsto x \cdot \color{blue}{\frac{\frac{\sin y}{y}}{z}} \]
      2. clear-num93.9%

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
      4. associate-/r/93.9%

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

        \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{\sin y}}}{y}} \]
    6. Applied egg-rr91.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{\sin y}}}{y}} \]
    7. Taylor expanded in y around 0 35.2%

      \[\leadsto \frac{\frac{x}{\color{blue}{0.16666666666666666 \cdot \left(y \cdot z\right) + \frac{z}{y}}}}{y} \]
    8. Taylor expanded in z around 0 33.8%

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

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

Alternative 7: 62.4% accurate, 5.9× 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.1 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\left(z_m \cdot y\right) \cdot 0.16666666666666666 + \frac{z_m}{y}}}{y}\\ \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 4.1e-14)
    (/ x z_m)
    (/ (/ x (+ (* (* z_m y) 0.16666666666666666) (/ z_m y))) y))))
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 <= 4.1e-14) {
		tmp = x / z_m;
	} else {
		tmp = (x / (((z_m * y) * 0.16666666666666666) + (z_m / y))) / y;
	}
	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 <= 4.1d-14) then
        tmp = x / z_m
    else
        tmp = (x / (((z_m * y) * 0.16666666666666666d0) + (z_m / y))) / y
    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 <= 4.1e-14) {
		tmp = x / z_m;
	} else {
		tmp = (x / (((z_m * y) * 0.16666666666666666) + (z_m / y))) / y;
	}
	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 <= 4.1e-14:
		tmp = x / z_m
	else:
		tmp = (x / (((z_m * y) * 0.16666666666666666) + (z_m / y))) / y
	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 <= 4.1e-14)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(Float64(x / Float64(Float64(Float64(z_m * y) * 0.16666666666666666) + Float64(z_m / y))) / y);
	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 <= 4.1e-14)
		tmp = x / z_m;
	else
		tmp = (x / (((z_m * y) * 0.16666666666666666) + (z_m / y))) / y;
	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, 4.1e-14], N[(x / z$95$m), $MachinePrecision], N[(N[(x / N[(N[(N[(z$95$m * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + N[(z$95$m / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $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.1 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.1%

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

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

    if 4.1000000000000002e-14 < y

    1. Initial program 95.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative93.8%

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

      \[\leadsto \color{blue}{x \cdot \frac{\sin y}{y \cdot z}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*93.7%

        \[\leadsto x \cdot \color{blue}{\frac{\frac{\sin y}{y}}{z}} \]
      2. clear-num93.6%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{\frac{\sin y}{y}}}} \]
      3. div-inv93.6%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
      4. associate-/r/93.6%

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{\sin y}}}{y}} \]
    7. Taylor expanded in y around 0 31.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.1 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\left(z \cdot y\right) \cdot 0.16666666666666666 + \frac{z}{y}}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.3% accurate, 7.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}\;y \leq 2.5:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{6 \cdot \frac{x}{z_m \cdot y}}{y}\\ \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 2.5) (/ x z_m) (/ (* 6.0 (/ x (* z_m y))) y))))
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 <= 2.5) {
		tmp = x / z_m;
	} else {
		tmp = (6.0 * (x / (z_m * y))) / y;
	}
	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 <= 2.5d0) then
        tmp = x / z_m
    else
        tmp = (6.0d0 * (x / (z_m * y))) / y
    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 <= 2.5) {
		tmp = x / z_m;
	} else {
		tmp = (6.0 * (x / (z_m * y))) / y;
	}
	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 <= 2.5:
		tmp = x / z_m
	else:
		tmp = (6.0 * (x / (z_m * y))) / y
	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 <= 2.5)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(Float64(6.0 * Float64(x / Float64(z_m * y))) / y);
	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 <= 2.5)
		tmp = x / z_m;
	else
		tmp = (6.0 * (x / (z_m * y))) / y;
	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, 2.5], N[(x / z$95$m), $MachinePrecision], N[(N[(6.0 * N[(x / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $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 2.5:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.1%

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

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

    if 2.5 < y

    1. Initial program 95.3%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative93.6%

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

      \[\leadsto \color{blue}{x \cdot \frac{\sin y}{y \cdot z}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*93.5%

        \[\leadsto x \cdot \color{blue}{\frac{\frac{\sin y}{y}}{z}} \]
      2. clear-num93.3%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{\frac{\sin y}{y}}}} \]
      3. div-inv93.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
      4. associate-/r/93.4%

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

        \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{\sin y}}}{y}} \]
    6. Applied egg-rr90.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{\sin y}}}{y}} \]
    7. Taylor expanded in y around 0 29.3%

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

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

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

Alternative 9: 62.0% accurate, 8.9× 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 3.05 \cdot 10^{-9}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z_m \cdot y}\\ \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 3.05e-9) (/ x z_m) (* y (/ x (* z_m y))))))
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 <= 3.05e-9) {
		tmp = x / z_m;
	} else {
		tmp = y * (x / (z_m * y));
	}
	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 <= 3.05d-9) then
        tmp = x / z_m
    else
        tmp = y * (x / (z_m * y))
    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 <= 3.05e-9) {
		tmp = x / z_m;
	} else {
		tmp = y * (x / (z_m * y));
	}
	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 <= 3.05e-9:
		tmp = x / z_m
	else:
		tmp = y * (x / (z_m * y))
	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 <= 3.05e-9)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(y * Float64(x / Float64(z_m * y)));
	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 <= 3.05e-9)
		tmp = x / z_m;
	else
		tmp = y * (x / (z_m * y));
	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, 3.05e-9], N[(x / z$95$m), $MachinePrecision], N[(y * N[(x / N[(z$95$m * y), $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}\;y \leq 3.05 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.1%

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

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

    if 3.05e-9 < y

    1. Initial program 95.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative93.8%

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

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

      \[\leadsto x \cdot \color{blue}{\frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv20.6%

        \[\leadsto \color{blue}{\frac{x}{z}} \]
      2. clear-num20.6%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity20.6%

        \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{z}{x}}} \]
      2. *-inverses20.6%

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y \cdot z}{y}}{x}}} \]
      5. clear-num23.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot z}{y}}} \]
      6. associate-/r/29.5%

        \[\leadsto \color{blue}{\frac{x}{y \cdot z} \cdot y} \]
    9. Applied egg-rr29.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.05 \cdot 10^{-9}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z \cdot y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 62.1% accurate, 8.9× 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 0.00037:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y \cdot \frac{z_m}{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 0.00037) (/ x z_m) (/ y (* 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 <= 0.00037) {
		tmp = x / z_m;
	} else {
		tmp = y / (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 <= 0.00037d0) then
        tmp = x / z_m
    else
        tmp = y / (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 <= 0.00037) {
		tmp = x / z_m;
	} else {
		tmp = y / (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 <= 0.00037:
		tmp = x / z_m
	else:
		tmp = y / (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 <= 0.00037)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(y / 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 <= 0.00037)
		tmp = x / z_m;
	else
		tmp = y / (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, 0.00037], N[(x / z$95$m), $MachinePrecision], N[(y / N[(y * N[(z$95$m / x), $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}\;y \leq 0.00037:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.1%

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

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

    if 3.6999999999999999e-4 < y

    1. Initial program 95.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative93.7%

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

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

      \[\leadsto x \cdot \color{blue}{\frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv19.7%

        \[\leadsto \color{blue}{\frac{x}{z}} \]
      2. clear-num19.7%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity19.7%

        \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{z}{x}}} \]
      2. *-inverses19.7%

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{y}} \cdot \frac{z}{x}} \]
      3. times-frac22.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y \cdot z}{y}}{x}}} \]
      5. clear-num22.8%

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot z}{y}}} \]
      6. associate-/r/28.7%

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

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

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

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

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

        \[\leadsto \frac{y}{\frac{y \cdot z}{\color{blue}{1 \cdot x}}} \]
      5. times-frac28.9%

        \[\leadsto \frac{y}{\color{blue}{\frac{y}{1} \cdot \frac{z}{x}}} \]
      6. /-rgt-identity28.9%

        \[\leadsto \frac{y}{\color{blue}{y} \cdot \frac{z}{x}} \]
    11. Applied egg-rr28.9%

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

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

Alternative 11: 62.2% accurate, 8.9× 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 2.1 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{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 (<= y 2.1e-8) (/ x z_m) (/ y (* 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 (y <= 2.1e-8) {
		tmp = x / z_m;
	} else {
		tmp = y / (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 (y <= 2.1d-8) then
        tmp = x / z_m
    else
        tmp = y / (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 (y <= 2.1e-8) {
		tmp = x / z_m;
	} else {
		tmp = y / (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 y <= 2.1e-8:
		tmp = x / z_m
	else:
		tmp = y / (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 (y <= 2.1e-8)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(y / Float64(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 (y <= 2.1e-8)
		tmp = x / z_m;
	else
		tmp = y / (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[y, 2.1e-8], N[(x / z$95$m), $MachinePrecision], N[(y / N[(z$95$m * N[(y / x), $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}\;y \leq 2.1 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 98.1%

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

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

    if 2.09999999999999994e-8 < y

    1. Initial program 95.4%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{\sin y}{z \cdot y}} \]
      3. *-commutative93.8%

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

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

      \[\leadsto x \cdot \color{blue}{\frac{1}{z}} \]
    6. Step-by-step derivation
      1. un-div-inv20.6%

        \[\leadsto \color{blue}{\frac{x}{z}} \]
      2. clear-num20.6%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity20.6%

        \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{z}{x}}} \]
      2. *-inverses20.6%

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y \cdot z}{y}}{x}}} \]
      5. clear-num23.7%

        \[\leadsto \color{blue}{\frac{x}{\frac{y \cdot z}{y}}} \]
      6. associate-/r/29.5%

        \[\leadsto \color{blue}{\frac{x}{y \cdot z} \cdot y} \]
    9. Applied egg-rr29.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{z}}{\frac{y}{x}}} \]
      6. associate-/l/29.8%

        \[\leadsto \color{blue}{\frac{y}{\frac{y}{x} \cdot z}} \]
    11. Applied egg-rr29.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.1 \cdot 10^{-8}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 58.8% accurate, 35.7× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z_s \cdot \frac{x}{z_m} \end{array} \]
z_m = (fabs.f64 z)
z_s = (copysign.f64 1 z)
(FPCore (z_s x y z_m) :precision binary64 (* z_s (/ 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) {
	return z_s * (x / z_m);
}
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 * (x / z_m)
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 * (x / z_m);
}
z_m = math.fabs(z)
z_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	return z_s * (x / z_m)
z_m = abs(z)
z_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	return Float64(z_s * Float64(x / z_m))
end
z_m = abs(z);
z_s = sign(z) * abs(1.0);
function tmp = code(z_s, x, y, z_m)
	tmp = z_s * (x / z_m);
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[(x / z$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
z_s \cdot \frac{x}{z_m}
\end{array}
Derivation
  1. Initial program 97.4%

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

    \[\leadsto \color{blue}{\frac{x}{z}} \]
  4. Final simplification63.0%

    \[\leadsto \frac{x}{z} \]
  5. Add Preprocessing

Developer target: 99.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{\sin y}\\ t_1 := \frac{x \cdot \frac{1}{t_0}}{z}\\ \mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\ \;\;\;\;\frac{x}{z \cdot t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ y (sin y))) (t_1 (/ (* x (/ 1.0 t_0)) z)))
   (if (< z -4.2173720203427147e-29)
     t_1
     (if (< z 4.446702369113811e+64) (/ x (* z t_0)) t_1))))
double code(double x, double y, double z) {
	double t_0 = y / sin(y);
	double t_1 = (x * (1.0 / t_0)) / z;
	double tmp;
	if (z < -4.2173720203427147e-29) {
		tmp = t_1;
	} else if (z < 4.446702369113811e+64) {
		tmp = x / (z * t_0);
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = y / sin(y)
    t_1 = (x * (1.0d0 / t_0)) / z
    if (z < (-4.2173720203427147d-29)) then
        tmp = t_1
    else if (z < 4.446702369113811d+64) then
        tmp = x / (z * t_0)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y / Math.sin(y);
	double t_1 = (x * (1.0 / t_0)) / z;
	double tmp;
	if (z < -4.2173720203427147e-29) {
		tmp = t_1;
	} else if (z < 4.446702369113811e+64) {
		tmp = x / (z * t_0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y / math.sin(y)
	t_1 = (x * (1.0 / t_0)) / z
	tmp = 0
	if z < -4.2173720203427147e-29:
		tmp = t_1
	elif z < 4.446702369113811e+64:
		tmp = x / (z * t_0)
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(y / sin(y))
	t_1 = Float64(Float64(x * Float64(1.0 / t_0)) / z)
	tmp = 0.0
	if (z < -4.2173720203427147e-29)
		tmp = t_1;
	elseif (z < 4.446702369113811e+64)
		tmp = Float64(x / Float64(z * t_0));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y / sin(y);
	t_1 = (x * (1.0 / t_0)) / z;
	tmp = 0.0;
	if (z < -4.2173720203427147e-29)
		tmp = t_1;
	elseif (z < 4.446702369113811e+64)
		tmp = x / (z * t_0);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Less[z, -4.2173720203427147e-29], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
t_1 := \frac{x \cdot \frac{1}{t_0}}{z}\\
\mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot t_0}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}

Reproduce

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

  :herbie-target
  (if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))

  (/ (* x (/ (sin y) y)) z))