Linear.Quaternion:$ctanh from linear-1.19.1.3

Percentage Accurate: 96.4% → 99.5%
Time: 9.6s
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.4% 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 2.9 \cdot 10^{-71}:\\ \;\;\;\;\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 2.9e-71) (/ 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 <= 2.9e-71) {
		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 <= 2.9d-71) 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 <= 2.9e-71) {
		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 <= 2.9e-71:
		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 <= 2.9e-71)
		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 <= 2.9e-71)
		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, 2.9e-71], 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.9 \cdot 10^{-71}:\\
\;\;\;\;\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 < 2.8999999999999999e-71

    1. Initial program 92.9%

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

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

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

    if 2.8999999999999999e-71 < z

    1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\frac{\sin y}{y} \cdot \frac{x}{z}} \]
    3. Simplified99.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}\;z \leq 2.9 \cdot 10^{-71}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 77.4% 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 7 \cdot 10^{-13}:\\ \;\;\;\;\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 7e-13) (/ 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 <= 7e-13) {
		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 <= 7d-13) 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 <= 7e-13) {
		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 <= 7e-13:
		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 <= 7e-13)
		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 <= 7e-13)
		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, 7e-13], 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 7 \cdot 10^{-13}:\\
\;\;\;\;\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 < 7.0000000000000005e-13

    1. Initial program 96.4%

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

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

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

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

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

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

    if 7.0000000000000005e-13 < y

    1. Initial program 90.9%

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

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

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

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

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

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

Alternative 3: 77.7% 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 3.8 \cdot 10^{-33}:\\ \;\;\;\;\frac{x}{z_m}\\ \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 3.8e-33) (/ x z_m) (* (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 <= 3.8e-33) {
		tmp = x / z_m;
	} 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 <= 3.8d-33) then
        tmp = x / z_m
    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 <= 3.8e-33) {
		tmp = x / z_m;
	} 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 <= 3.8e-33:
		tmp = x / z_m
	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 <= 3.8e-33)
		tmp = Float64(x / z_m);
	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 <= 3.8e-33)
		tmp = x / z_m;
	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, 3.8e-33], N[(x / z$95$m), $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 3.8 \cdot 10^{-33}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 96.3%

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

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

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

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

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

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

    if 3.79999999999999994e-33 < y

    1. Initial program 91.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.2% accurate, 1.0× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z_s \cdot \left(\frac{\sin y}{y} \cdot \frac{x}{z_m}\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 (* (/ (sin y) 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) {
	return z_s * ((sin(y) / y) * (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 * ((sin(y) / y) * (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 * ((Math.sin(y) / y) * (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 * ((math.sin(y) / y) * (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(Float64(sin(y) / y) * 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 * ((sin(y) / y) * (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[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / 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 \left(\frac{\sin y}{y} \cdot \frac{x}{z_m}\right)
\end{array}
Derivation
  1. Initial program 94.8%

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

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

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

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

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

Alternative 5: 62.6% accurate, 6.3× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z_s \cdot \begin{array}{l} \mathbf{if}\;y \leq 1.95 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{1}{x \cdot \frac{-1}{z_m \cdot \left(-y\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 1.95e-7) (/ x z_m) (/ y (/ 1.0 (* x (/ -1.0 (* 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 <= 1.95e-7) {
		tmp = x / z_m;
	} else {
		tmp = y / (1.0 / (x * (-1.0 / (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 <= 1.95d-7) then
        tmp = x / z_m
    else
        tmp = y / (1.0d0 / (x * ((-1.0d0) / (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 <= 1.95e-7) {
		tmp = x / z_m;
	} else {
		tmp = y / (1.0 / (x * (-1.0 / (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 <= 1.95e-7:
		tmp = x / z_m
	else:
		tmp = y / (1.0 / (x * (-1.0 / (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 <= 1.95e-7)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(y / Float64(1.0 / Float64(x * Float64(-1.0 / Float64(z_m * Float64(-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 <= 1.95e-7)
		tmp = x / z_m;
	else
		tmp = y / (1.0 / (x * (-1.0 / (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, 1.95e-7], N[(x / z$95$m), $MachinePrecision], N[(y / N[(1.0 / N[(x * N[(-1.0 / N[(z$95$m * (-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 1.95 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 96.4%

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

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

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

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

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

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

    if 1.95000000000000012e-7 < y

    1. Initial program 90.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 \cdot \left(x \cdot \frac{1}{z}\right)} \]
      2. div-inv16.1%

        \[\leadsto 1 \cdot \color{blue}{\frac{x}{z}} \]
      3. *-commutative16.1%

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

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y}{y}} \]
      5. times-frac18.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{y}}{z}} \]
      8. *-commutative15.9%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{\frac{x}{y}}}} \]
      11. div-inv27.1%

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

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{\frac{1}{\frac{x}{y \cdot z}}}} \]
    9. Applied egg-rr27.2%

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{\frac{x}{y \cdot z}}}} \]
    10. Step-by-step derivation
      1. clear-num27.2%

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

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

        \[\leadsto \frac{y}{\frac{1}{\color{blue}{\frac{1}{-y \cdot z} \cdot \left(-x\right)}}} \]
      4. distribute-rgt-neg-in27.2%

        \[\leadsto \frac{y}{\frac{1}{\frac{1}{\color{blue}{y \cdot \left(-z\right)}} \cdot \left(-x\right)}} \]
    11. Applied egg-rr27.2%

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

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

Alternative 6: 60.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 10^{+99}:\\ \;\;\;\;\frac{1}{\frac{z_m}{x}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{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 1e+99) (/ 1.0 (/ z_m x)) (* x (/ 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 <= 1e+99) {
		tmp = 1.0 / (z_m / x);
	} else {
		tmp = x * (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 <= 1d+99) then
        tmp = 1.0d0 / (z_m / x)
    else
        tmp = x * (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 <= 1e+99) {
		tmp = 1.0 / (z_m / x);
	} else {
		tmp = x * (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 <= 1e+99:
		tmp = 1.0 / (z_m / x)
	else:
		tmp = x * (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 <= 1e+99)
		tmp = Float64(1.0 / Float64(z_m / x));
	else
		tmp = Float64(x * Float64(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 <= 1e+99)
		tmp = 1.0 / (z_m / x);
	else
		tmp = x * (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, 1e+99], N[(1.0 / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / 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 10^{+99}:\\
\;\;\;\;\frac{1}{\frac{z_m}{x}}\\

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


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

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

    if 9.9999999999999997e98 < y

    1. Initial program 89.0%

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

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

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

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

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

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

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

Alternative 7: 62.3% 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 8 \cdot 10^{+15}:\\ \;\;\;\;\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 8e+15) (/ 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 <= 8e+15) {
		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 <= 8d+15) 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 <= 8e+15) {
		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 <= 8e+15:
		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 <= 8e+15)
		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 <= 8e+15)
		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, 8e+15], 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 8 \cdot 10^{+15}:\\
\;\;\;\;\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 < 8e15

    1. Initial program 96.4%

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

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

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

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

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

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

    if 8e15 < y

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{z \cdot y}} \]
    8. Simplified26.9%

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

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

Alternative 8: 62.5% 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.12:\\ \;\;\;\;\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.12) (/ 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.12) {
		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.12d0) 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.12) {
		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.12:
		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.12)
		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.12)
		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.12], 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.12:\\
\;\;\;\;\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 < 0.12

    1. Initial program 96.4%

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

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

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

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

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

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

    if 0.12 < y

    1. Initial program 90.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 \cdot \left(x \cdot \frac{1}{z}\right)} \]
      2. div-inv16.1%

        \[\leadsto 1 \cdot \color{blue}{\frac{x}{z}} \]
      3. *-commutative16.1%

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

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y}{y}} \]
      5. times-frac18.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{y}}{z}} \]
      8. *-commutative15.9%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{\frac{x}{y}}}} \]
      11. div-inv27.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot z} \cdot y} \]
    10. Step-by-step derivation
      1. clear-num27.2%

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

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

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

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

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

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

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

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

Alternative 9: 62.6% 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 1.18 \cdot 10^{-15}:\\ \;\;\;\;\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 1.18e-15) (/ 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 <= 1.18e-15) {
		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 <= 1.18d-15) 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 <= 1.18e-15) {
		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 <= 1.18e-15:
		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 <= 1.18e-15)
		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 <= 1.18e-15)
		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, 1.18e-15], 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 1.18 \cdot 10^{-15}:\\
\;\;\;\;\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 < 1.18000000000000004e-15

    1. Initial program 96.4%

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

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

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

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

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

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

    if 1.18000000000000004e-15 < y

    1. Initial program 90.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 \cdot \left(x \cdot \frac{1}{z}\right)} \]
      2. div-inv16.1%

        \[\leadsto 1 \cdot \color{blue}{\frac{x}{z}} \]
      3. *-commutative16.1%

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

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y}{y}} \]
      5. times-frac18.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{y}}{z}} \]
      8. *-commutative15.9%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{\frac{x}{y}}}} \]
      11. div-inv27.1%

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

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

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

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

Alternative 10: 62.6% 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.0014:\\ \;\;\;\;\frac{x}{z_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z_m \cdot 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 0.0014) (/ 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 <= 0.0014) {
		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 <= 0.0014d0) 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 <= 0.0014) {
		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 <= 0.0014:
		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 <= 0.0014)
		tmp = Float64(x / z_m);
	else
		tmp = Float64(y / Float64(Float64(z_m * 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 <= 0.0014)
		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, 0.0014], N[(x / z$95$m), $MachinePrecision], N[(y / N[(N[(z$95$m * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
z_s = \mathsf{copysign}\left(1, z\right)

\\
z_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 0.0014:\\
\;\;\;\;\frac{x}{z_m}\\

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


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

    1. Initial program 96.4%

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

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

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

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

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

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

    if 0.00139999999999999999 < y

    1. Initial program 90.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{1 \cdot \left(x \cdot \frac{1}{z}\right)} \]
      2. div-inv16.1%

        \[\leadsto 1 \cdot \color{blue}{\frac{x}{z}} \]
      3. *-commutative16.1%

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

        \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{y}{y}} \]
      5. times-frac18.2%

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

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

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{y}}{z}} \]
      8. *-commutative15.9%

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{\frac{x}{y}}}} \]
      11. div-inv27.1%

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

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

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

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

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

Alternative 11: 58.3% accurate, 21.4× speedup?

\[\begin{array}{l} z_m = \left|z\right| \\ z_s = \mathsf{copysign}\left(1, z\right) \\ z_s \cdot \frac{1}{\frac{z_m}{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 (/ 1.0 (/ z_m x))))
z_m = fabs(z);
z_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	return z_s * (1.0 / (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 * (1.0d0 / (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 * (1.0 / (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 * (1.0 / (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(1.0 / 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 * (1.0 / (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[(1.0 / 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{1}{\frac{z_m}{x}}
\end{array}
Derivation
  1. Initial program 94.8%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{z}{x}}} \]
  8. Final simplification52.9%

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

Alternative 12: 58.4% 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 94.8%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{z}} \]
  6. Final simplification52.6%

    \[\leadsto \frac{x}{z} \]
  7. 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 2024020 
(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))