Linear.Quaternion:$ctanh from linear-1.19.1.3

Percentage Accurate: 96.0% → 99.6%
Time: 7.4s
Alternatives: 10
Speedup: 0.9×

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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    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}

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 10 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    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.6% 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}\;z\_m \leq 3.8 \cdot 10^{+33}:\\ \;\;\;\;\frac{x}{\frac{z\_m}{\sin y} \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z\_m}\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= z_m 3.8e+33)
    (/ x (* (/ z_m (sin y)) y))
    (/ (* x (/ (sin y) y)) z_m))))
z\_m = fabs(z);
z\_s = copysign(1.0, z);
double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 3.8e+33) {
		tmp = x / ((z_m / sin(y)) * y);
	} else {
		tmp = (x * (sin(y) / y)) / z_m;
	}
	return z_s * tmp;
}
z\_m =     private
z\_s =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(z_s, x, y, z_m)
use fmin_fmax_functions
    real(8), intent (in) :: z_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z_m
    real(8) :: tmp
    if (z_m <= 3.8d+33) then
        tmp = x / ((z_m / sin(y)) * y)
    else
        tmp = (x * (sin(y) / y)) / z_m
    end if
    code = z_s * tmp
end function
z\_m = Math.abs(z);
z\_s = Math.copySign(1.0, z);
public static double code(double z_s, double x, double y, double z_m) {
	double tmp;
	if (z_m <= 3.8e+33) {
		tmp = x / ((z_m / Math.sin(y)) * y);
	} else {
		tmp = (x * (Math.sin(y) / y)) / z_m;
	}
	return z_s * tmp;
}
z\_m = math.fabs(z)
z\_s = math.copysign(1.0, z)
def code(z_s, x, y, z_m):
	tmp = 0
	if z_m <= 3.8e+33:
		tmp = x / ((z_m / math.sin(y)) * y)
	else:
		tmp = (x * (math.sin(y) / y)) / z_m
	return z_s * tmp
z\_m = abs(z)
z\_s = copysign(1.0, z)
function code(z_s, x, y, z_m)
	tmp = 0.0
	if (z_m <= 3.8e+33)
		tmp = Float64(x / Float64(Float64(z_m / sin(y)) * y));
	else
		tmp = Float64(Float64(x * Float64(sin(y) / y)) / z_m);
	end
	return Float64(z_s * tmp)
end
z\_m = abs(z);
z\_s = sign(z) * abs(1.0);
function tmp_2 = code(z_s, x, y, z_m)
	tmp = 0.0;
	if (z_m <= 3.8e+33)
		tmp = x / ((z_m / sin(y)) * y);
	else
		tmp = (x * (sin(y) / y)) / z_m;
	end
	tmp_2 = z_s * tmp;
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 3.8e+33], N[(x / N[(N[(z$95$m / N[Sin[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z$95$m), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 3.8 \cdot 10^{+33}:\\
\;\;\;\;\frac{x}{\frac{z\_m}{\sin y} \cdot y}\\

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


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

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}} \]
      3. lower-unsound-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}} \]
      4. lower-unsound-/.f6495.4

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

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

        \[\leadsto \frac{1}{\frac{z}{\color{blue}{\frac{\sin y}{y} \cdot x}}} \]
      7. lower-*.f6495.4

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{\sin y}{y} \cdot x}}} \]
      2. lift-/.f64N/A

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{z}{\frac{\sin y}{y}}}{x}}} \]
      5. div-flip-revN/A

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{x}{\frac{z}{\color{blue}{\frac{\sin y}{y}}}} \]
      8. associate-/r/N/A

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{\sin y} \cdot y}} \]
      9. lower-*.f64N/A

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{\sin y} \cdot y}} \]
      10. lower-/.f6488.4

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{\sin y}} \cdot y} \]
    5. Applied rewrites88.4%

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

    if 3.80000000000000002e33 < z

    1. Initial program 96.0%

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

Alternative 2: 75.4% 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 0.0003:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y}{z\_m}}{y} \cdot x\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= y 0.0003)
    (/ (fma (* -0.16666666666666666 (* y y)) x x) z_m)
    (* (/ (/ (sin 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.0003) {
		tmp = fma((-0.16666666666666666 * (y * y)), x, x) / z_m;
	} else {
		tmp = ((sin(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.0003)
		tmp = Float64(fma(Float64(-0.16666666666666666 * Float64(y * y)), x, x) / z_m);
	else
		tmp = Float64(Float64(Float64(sin(y) / z_m) / y) * x);
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[y, 0.0003], N[(N[(N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(N[(N[Sin[y], $MachinePrecision] / z$95$m), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 0.0003:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\

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


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

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      4. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      5. lower-/.f6451.2

        \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
    4. Applied rewrites51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{x \cdot {y}^{2}}{z} \cdot \frac{-1}{6} + \frac{x}{z} \]
      4. lift-*.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      13. lift-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      14. unpow2N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      15. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      16. lower-/.f6453.2

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right) \]
    6. Applied rewrites53.2%

      \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto x \cdot \left(\frac{y \cdot y}{z} \cdot \frac{-1}{6} + \color{blue}{\frac{1}{z}}\right) \]
      3. distribute-rgt-inN/A

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

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

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

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

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

        \[\leadsto \frac{\left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right) \cdot x}{z} + x \cdot \frac{1}{\color{blue}{z}} \]
      9. mult-flip-revN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{6} \cdot \left(y \cdot y\right), x, x\right)}{z} \]
      14. lower-*.f6453.4

        \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z} \]
    8. Applied rewrites53.4%

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

    if 2.99999999999999974e-4 < y

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sin y}{\color{blue}{z \cdot y}} \cdot x \]
      10. lower-*.f6488.0

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{\sin y}{z}}{y}} \cdot x \]
      5. lower-/.f6489.1

        \[\leadsto \frac{\color{blue}{\frac{\sin y}{z}}}{y} \cdot x \]
    5. Applied rewrites89.1%

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

Alternative 3: 75.3% 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 0.0003:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin y}{z\_m \cdot y} \cdot x\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= y 0.0003)
    (/ (fma (* -0.16666666666666666 (* y y)) x x) z_m)
    (* (/ (sin 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.0003) {
		tmp = fma((-0.16666666666666666 * (y * y)), x, x) / z_m;
	} else {
		tmp = (sin(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.0003)
		tmp = Float64(fma(Float64(-0.16666666666666666 * Float64(y * y)), x, x) / z_m);
	else
		tmp = Float64(Float64(sin(y) / Float64(z_m * y)) * x);
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[y, 0.0003], N[(N[(N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(N[Sin[y], $MachinePrecision] / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
z\_m = \left|z\right|
\\
z\_s = \mathsf{copysign}\left(1, z\right)

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 0.0003:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\

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


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

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      4. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      5. lower-/.f6451.2

        \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
    4. Applied rewrites51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{x \cdot {y}^{2}}{z} \cdot \frac{-1}{6} + \frac{x}{z} \]
      4. lift-*.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      13. lift-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      14. unpow2N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      15. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      16. lower-/.f6453.2

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right) \]
    6. Applied rewrites53.2%

      \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto x \cdot \left(\frac{y \cdot y}{z} \cdot \frac{-1}{6} + \color{blue}{\frac{1}{z}}\right) \]
      3. distribute-rgt-inN/A

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

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

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

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

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

        \[\leadsto \frac{\left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right) \cdot x}{z} + x \cdot \frac{1}{\color{blue}{z}} \]
      9. mult-flip-revN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{6} \cdot \left(y \cdot y\right), x, x\right)}{z} \]
      14. lower-*.f6453.4

        \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z} \]
    8. Applied rewrites53.4%

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

    if 2.99999999999999974e-4 < y

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sin y}{\color{blue}{z \cdot y}} \cdot x \]
      10. lower-*.f6488.0

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

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

Alternative 4: 75.3% 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 0.00055:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z\_m \cdot y} \cdot \sin y\\ \end{array} \end{array} \]
z\_m = (fabs.f64 z)
z\_s = (copysign.f64 #s(literal 1 binary64) z)
(FPCore (z_s x y z_m)
 :precision binary64
 (*
  z_s
  (if (<= y 0.00055)
    (/ (fma (* -0.16666666666666666 (* y y)) x x) z_m)
    (* (/ x (* z_m y)) (sin 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 <= 0.00055) {
		tmp = fma((-0.16666666666666666 * (y * y)), x, x) / z_m;
	} else {
		tmp = (x / (z_m * y)) * sin(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 <= 0.00055)
		tmp = Float64(fma(Float64(-0.16666666666666666 * Float64(y * y)), x, x) / z_m);
	else
		tmp = Float64(Float64(x / Float64(z_m * y)) * sin(y));
	end
	return Float64(z_s * tmp)
end
z\_m = N[Abs[z], $MachinePrecision]
z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[y, 0.00055], N[(N[(N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] / z$95$m), $MachinePrecision], N[(N[(x / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] * N[Sin[y], $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.00055:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\

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


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

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      4. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      5. lower-/.f6451.2

        \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
    4. Applied rewrites51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{x \cdot {y}^{2}}{z} \cdot \frac{-1}{6} + \frac{x}{z} \]
      4. lift-*.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      13. lift-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      14. unpow2N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      15. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      16. lower-/.f6453.2

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right) \]
    6. Applied rewrites53.2%

      \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto x \cdot \left(\frac{y \cdot y}{z} \cdot \frac{-1}{6} + \color{blue}{\frac{1}{z}}\right) \]
      3. distribute-rgt-inN/A

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

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

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

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

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

        \[\leadsto \frac{\left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right) \cdot x}{z} + x \cdot \frac{1}{\color{blue}{z}} \]
      9. mult-flip-revN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{6} \cdot \left(y \cdot y\right), x, x\right)}{z} \]
      14. lower-*.f6453.4

        \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z} \]
    8. Applied rewrites53.4%

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

    if 5.50000000000000033e-4 < y

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot \frac{\sin y}{y}}{z}} \]
      2. mult-flipN/A

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

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

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

        \[\leadsto \left(\color{blue}{\frac{\sin y}{y}} \cdot x\right) \cdot \frac{1}{z} \]
      6. mult-flipN/A

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

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

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{y} \cdot x\right) \cdot \frac{1}{z}\right) \cdot \sin y} \]
      11. mult-flip-revN/A

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

        \[\leadsto \frac{\color{blue}{x \cdot \frac{1}{y}}}{z} \cdot \sin y \]
      13. mult-flip-revN/A

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

        \[\leadsto \color{blue}{\frac{x}{y \cdot z}} \cdot \sin y \]
      15. lower-/.f64N/A

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

        \[\leadsto \frac{x}{\color{blue}{z \cdot y}} \cdot \sin y \]
      17. lower-*.f6483.6

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

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

Alternative 5: 65.9% accurate, 0.5× speedup?

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

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


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

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      4. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      5. lower-/.f6451.2

        \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
    4. Applied rewrites51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

        \[\leadsto \frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{\color{blue}{z}} \]
      3. add-to-fractionN/A

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{x \cdot {y}^{2}}{z} \cdot \frac{-1}{6}, z, x\right)}} \]
      9. lower-*.f6451.9

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{x \cdot {y}^{2}}{z} \cdot -0.16666666666666666, z, x\right)}} \]
      10. lift-*.f64N/A

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

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{{y}^{2} \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}} \]
      12. lower-*.f6451.9

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{{y}^{2} \cdot x}{z} \cdot -0.16666666666666666, z, x\right)}} \]
      13. lift-pow.f64N/A

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{{y}^{2} \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}} \]
      14. unpow2N/A

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}} \]
      15. lower-*.f6451.9

        \[\leadsto \frac{1}{\frac{z}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot -0.16666666666666666, z, x\right)}} \]
    6. Applied rewrites51.9%

      \[\leadsto \frac{1}{\color{blue}{\frac{z}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot -0.16666666666666666, z, x\right)}}} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}{z}}}} \]
      3. lower-unsound-/.f32N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}{\color{blue}{z}}}} \]
      4. lower-/.f32N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}{\color{blue}{z}}}} \]
      5. div-flip-revN/A

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

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{\frac{z}{\color{blue}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}}}}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{\color{blue}{\frac{z}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}}}}} \]
      8. lower-unsound-/.f6451.9

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{1}{\frac{z}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot -0.16666666666666666, z, x\right)}}}}} \]
      9. lift-/.f64N/A

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

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{\frac{z}{\color{blue}{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}}}}} \]
      11. div-flip-revN/A

        \[\leadsto \frac{1}{\frac{1}{\frac{\mathsf{fma}\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}, z, x\right)}{\color{blue}{z}}}} \]
      12. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{\left(\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6}\right) \cdot z + x}{z}}} \]
      13. add-to-fraction-revN/A

        \[\leadsto \frac{1}{\frac{1}{\frac{\left(y \cdot y\right) \cdot x}{z} \cdot \frac{-1}{6} + \color{blue}{\frac{x}{z}}}} \]
    8. Applied rewrites53.0%

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\frac{\mathsf{fma}\left(-0.16666666666666666, y \cdot y, 1\right)}{z} \cdot x}}} \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

        \[\leadsto \frac{1}{\frac{\frac{1}{x}}{\color{blue}{\frac{\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right)}{z}}}} \]
      5. mult-flipN/A

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

        \[\leadsto \frac{1}{\frac{1 \cdot \frac{1}{x}}{\frac{\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right)}{\color{blue}{z}}}} \]
      7. mult-flipN/A

        \[\leadsto \frac{1}{\frac{1 \cdot \frac{1}{x}}{\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right) \cdot \color{blue}{\frac{1}{z}}}} \]
      8. lift-/.f64N/A

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

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

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

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \color{blue}{\frac{\frac{1}{x}}{\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right)}}} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \frac{\color{blue}{\frac{1}{x}}}{\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right)}} \]
      13. lower-/.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \frac{\frac{1}{x}}{\color{blue}{\mathsf{fma}\left(\frac{-1}{6}, y \cdot y, 1\right)}}} \]
      14. lower-/.f6452.9

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \frac{\frac{1}{x}}{\mathsf{fma}\left(\color{blue}{-0.16666666666666666}, y \cdot y, 1\right)}} \]
      15. lift-fma.f64N/A

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

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

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \frac{\frac{1}{x}}{\left(\frac{-1}{6} \cdot y\right) \cdot y + 1}} \]
      18. lower-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \frac{\frac{1}{x}}{\mathsf{fma}\left(\frac{-1}{6} \cdot y, \color{blue}{y}, 1\right)}} \]
      19. lower-*.f6452.9

        \[\leadsto \frac{1}{\frac{1}{\frac{1}{z}} \cdot \frac{\frac{1}{x}}{\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right)}} \]
    10. Applied rewrites52.9%

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

    if -4.99999999999999972e-30 < (/.f64 (*.f64 x (/.f64 (sin.f64 y) y)) z)

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}} \]
      3. lower-unsound-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}} \]
      4. lower-unsound-/.f6495.4

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

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

        \[\leadsto \frac{1}{\frac{z}{\color{blue}{\frac{\sin y}{y} \cdot x}}} \]
      7. lower-*.f6495.4

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{\sin y}{y} \cdot x}}} \]
    4. Taylor expanded in y around 0

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{6} \cdot \frac{{y}^{2} \cdot z}{x} + \frac{z}{x}}} \]
    5. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{1}{6}, \frac{{y}^{2} \cdot z}{x}, \frac{z}{x}\right)} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{1}{6}, \frac{{y}^{2} \cdot z}{x}, \frac{z}{x}\right)} \]
      5. lower-/.f6465.8

        \[\leadsto \frac{1}{\mathsf{fma}\left(0.16666666666666666, \frac{{y}^{2} \cdot z}{x}, \frac{z}{x}\right)} \]
    6. Applied rewrites65.8%

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

Alternative 6: 62.7% accurate, 2.2× speedup?

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

\\
z\_s \cdot \begin{array}{l}
\mathbf{if}\;z\_m \leq 2.35 \cdot 10^{-35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.35e-35

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
    3. Step-by-step derivation
      1. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      4. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      5. lower-/.f6451.2

        \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
    4. Applied rewrites51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{x \cdot {y}^{2}}{z} \cdot \frac{-1}{6} + \frac{x}{z} \]
      4. lift-*.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      13. lift-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      14. unpow2N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      15. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
      16. lower-/.f6453.2

        \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right) \]
    6. Applied rewrites53.2%

      \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right)} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto x \cdot \left(\frac{y \cdot y}{z} \cdot \frac{-1}{6} + \color{blue}{\frac{1}{z}}\right) \]
      3. distribute-rgt-inN/A

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

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

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

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

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

        \[\leadsto \frac{\left(\left(y \cdot y\right) \cdot \frac{-1}{6}\right) \cdot x}{z} + x \cdot \frac{1}{\color{blue}{z}} \]
      9. mult-flip-revN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{6} \cdot \left(y \cdot y\right), x, x\right)}{z} \]
      14. lower-*.f6453.4

        \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666 \cdot \left(y \cdot y\right), x, x\right)}{z} \]
    8. Applied rewrites53.4%

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

    if 2.35e-35 < z

    1. Initial program 96.0%

      \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sin y}{\color{blue}{z \cdot y}} \cdot x \]
      10. lower-*.f6488.0

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

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

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

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

    Alternative 7: 62.5% accurate, 2.2× speedup?

    \[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 2.35 \cdot 10^{-35}:\\ \;\;\;\;\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right) \cdot \frac{x}{z\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z\_m \cdot y} \cdot x\\ \end{array} \end{array} \]
    z\_m = (fabs.f64 z)
    z\_s = (copysign.f64 #s(literal 1 binary64) z)
    (FPCore (z_s x y z_m)
     :precision binary64
     (*
      z_s
      (if (<= z_m 2.35e-35)
        (* (fma (* -0.16666666666666666 y) y 1.0) (/ 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 (z_m <= 2.35e-35) {
    		tmp = fma((-0.16666666666666666 * y), y, 1.0) * (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 (z_m <= 2.35e-35)
    		tmp = Float64(fma(Float64(-0.16666666666666666 * y), y, 1.0) * Float64(x / z_m));
    	else
    		tmp = Float64(Float64(y / Float64(z_m * y)) * x);
    	end
    	return Float64(z_s * tmp)
    end
    
    z\_m = N[Abs[z], $MachinePrecision]
    z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 2.35e-35], N[(N[(N[(-0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * N[(x / z$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]
    
    \begin{array}{l}
    z\_m = \left|z\right|
    \\
    z\_s = \mathsf{copysign}\left(1, z\right)
    
    \\
    z\_s \cdot \begin{array}{l}
    \mathbf{if}\;z\_m \leq 2.35 \cdot 10^{-35}:\\
    \;\;\;\;\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right) \cdot \frac{x}{z\_m}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{y}{z\_m \cdot y} \cdot x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < 2.35e-35

      1. Initial program 96.0%

        \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
      2. Taylor expanded in y around 0

        \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
      3. Step-by-step derivation
        1. lower-fma.f64N/A

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

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

          \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
        4. lower-pow.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
        5. lower-/.f6451.2

          \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
      4. Applied rewrites51.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
      5. Step-by-step derivation
        1. lift-fma.f64N/A

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

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

          \[\leadsto \frac{x}{z} + \color{blue}{\frac{-1}{6}} \cdot \frac{x \cdot {y}^{2}}{z} \]
        4. lift-/.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \left(\left(x \cdot {y}^{2}\right) \cdot \frac{-1}{6} + x\right) \cdot \frac{1}{z} \]
        13. lower-fma.f64N/A

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

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

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

          \[\leadsto \mathsf{fma}\left({y}^{2} \cdot x, \frac{-1}{6}, x\right) \cdot \frac{1}{z} \]
        17. lift-pow.f64N/A

          \[\leadsto \mathsf{fma}\left({y}^{2} \cdot x, \frac{-1}{6}, x\right) \cdot \frac{1}{z} \]
        18. unpow2N/A

          \[\leadsto \mathsf{fma}\left(\left(y \cdot y\right) \cdot x, \frac{-1}{6}, x\right) \cdot \frac{1}{z} \]
        19. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\left(y \cdot y\right) \cdot x, \frac{-1}{6}, x\right) \cdot \frac{1}{z} \]
        20. lower-/.f6453.2

          \[\leadsto \mathsf{fma}\left(\left(y \cdot y\right) \cdot x, -0.16666666666666666, x\right) \cdot \frac{1}{\color{blue}{z}} \]
      6. Applied rewrites53.2%

        \[\leadsto \mathsf{fma}\left(\left(y \cdot y\right) \cdot x, -0.16666666666666666, x\right) \cdot \color{blue}{\frac{1}{z}} \]
      7. Applied rewrites55.1%

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

      if 2.35e-35 < z

      1. Initial program 96.0%

        \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\sin y}{\color{blue}{z \cdot y}} \cdot x \]
        10. lower-*.f6488.0

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

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

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

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

      Alternative 8: 62.5% accurate, 2.2× speedup?

      \[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 2.35 \cdot 10^{-35}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666, y \cdot y, 1\right)}{z\_m} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z\_m \cdot y} \cdot x\\ \end{array} \end{array} \]
      z\_m = (fabs.f64 z)
      z\_s = (copysign.f64 #s(literal 1 binary64) z)
      (FPCore (z_s x y z_m)
       :precision binary64
       (*
        z_s
        (if (<= z_m 2.35e-35)
          (* (/ (fma -0.16666666666666666 (* y y) 1.0) z_m) x)
          (* (/ 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 (z_m <= 2.35e-35) {
      		tmp = (fma(-0.16666666666666666, (y * y), 1.0) / z_m) * x;
      	} 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 (z_m <= 2.35e-35)
      		tmp = Float64(Float64(fma(-0.16666666666666666, Float64(y * y), 1.0) / z_m) * x);
      	else
      		tmp = Float64(Float64(y / Float64(z_m * y)) * x);
      	end
      	return Float64(z_s * tmp)
      end
      
      z\_m = N[Abs[z], $MachinePrecision]
      z\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
      code[z$95$s_, x_, y_, z$95$m_] := N[(z$95$s * If[LessEqual[z$95$m, 2.35e-35], N[(N[(N[(-0.16666666666666666 * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] / z$95$m), $MachinePrecision] * x), $MachinePrecision], N[(N[(y / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]
      
      \begin{array}{l}
      z\_m = \left|z\right|
      \\
      z\_s = \mathsf{copysign}\left(1, z\right)
      
      \\
      z\_s \cdot \begin{array}{l}
      \mathbf{if}\;z\_m \leq 2.35 \cdot 10^{-35}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(-0.16666666666666666, y \cdot y, 1\right)}{z\_m} \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{y}{z\_m \cdot y} \cdot x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < 2.35e-35

        1. Initial program 96.0%

          \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
        2. Taylor expanded in y around 0

          \[\leadsto \color{blue}{\frac{-1}{6} \cdot \frac{x \cdot {y}^{2}}{z} + \frac{x}{z}} \]
        3. Step-by-step derivation
          1. lower-fma.f64N/A

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

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

            \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
          4. lower-pow.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{-1}{6}, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
          5. lower-/.f6451.2

            \[\leadsto \mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right) \]
        4. Applied rewrites51.2%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{x \cdot {y}^{2}}{z}, \frac{x}{z}\right)} \]
        5. Step-by-step derivation
          1. lift-fma.f64N/A

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

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

            \[\leadsto \frac{x \cdot {y}^{2}}{z} \cdot \frac{-1}{6} + \frac{x}{z} \]
          4. lift-*.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
          13. lift-pow.f64N/A

            \[\leadsto x \cdot \mathsf{fma}\left(\frac{{y}^{2}}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
          14. unpow2N/A

            \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
          15. lower-*.f64N/A

            \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \]
          16. lower-/.f6453.2

            \[\leadsto x \cdot \mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right) \]
        6. Applied rewrites53.2%

          \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(\frac{y \cdot y}{z}, -0.16666666666666666, \frac{1}{z}\right)} \]
        7. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \mathsf{fma}\left(\frac{y \cdot y}{z}, \frac{-1}{6}, \frac{1}{z}\right) \cdot \color{blue}{x} \]
          3. lower-*.f6453.2

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

            \[\leadsto \left(\frac{y \cdot y}{z} \cdot \frac{-1}{6} + \frac{1}{z}\right) \cdot x \]
          5. lift-/.f64N/A

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

            \[\leadsto \left(\frac{\left(y \cdot y\right) \cdot \frac{-1}{6}}{z} + \frac{1}{z}\right) \cdot x \]
          7. lift-/.f64N/A

            \[\leadsto \left(\frac{\left(y \cdot y\right) \cdot \frac{-1}{6}}{z} + \frac{1}{z}\right) \cdot x \]
          8. div-add-revN/A

            \[\leadsto \frac{\left(y \cdot y\right) \cdot \frac{-1}{6} + 1}{z} \cdot x \]
          9. lower-/.f64N/A

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

            \[\leadsto \frac{\frac{-1}{6} \cdot \left(y \cdot y\right) + 1}{z} \cdot x \]
          11. lower-fma.f6453.2

            \[\leadsto \frac{\mathsf{fma}\left(-0.16666666666666666, y \cdot y, 1\right)}{z} \cdot x \]
        8. Applied rewrites53.2%

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

        if 2.35e-35 < z

        1. Initial program 96.0%

          \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\sin y}{\color{blue}{z \cdot y}} \cdot x \]
          10. lower-*.f6488.0

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

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

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

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

        Alternative 9: 62.4% accurate, 3.0× speedup?

        \[\begin{array}{l} z\_m = \left|z\right| \\ z\_s = \mathsf{copysign}\left(1, z\right) \\ z\_s \cdot \begin{array}{l} \mathbf{if}\;z\_m \leq 8.2 \cdot 10^{+37}:\\ \;\;\;\;\frac{1}{\frac{z\_m}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z\_m \cdot y} \cdot x\\ \end{array} \end{array} \]
        z\_m = (fabs.f64 z)
        z\_s = (copysign.f64 #s(literal 1 binary64) z)
        (FPCore (z_s x y z_m)
         :precision binary64
         (* z_s (if (<= z_m 8.2e+37) (/ 1.0 (/ z_m x)) (* (/ 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 (z_m <= 8.2e+37) {
        		tmp = 1.0 / (z_m / x);
        	} else {
        		tmp = (y / (z_m * y)) * x;
        	}
        	return z_s * tmp;
        }
        
        z\_m =     private
        z\_s =     private
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(z_s, x, y, z_m)
        use fmin_fmax_functions
            real(8), intent (in) :: z_s
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z_m
            real(8) :: tmp
            if (z_m <= 8.2d+37) then
                tmp = 1.0d0 / (z_m / x)
            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 (z_m <= 8.2e+37) {
        		tmp = 1.0 / (z_m / x);
        	} 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 z_m <= 8.2e+37:
        		tmp = 1.0 / (z_m / x)
        	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 (z_m <= 8.2e+37)
        		tmp = Float64(1.0 / Float64(z_m / x));
        	else
        		tmp = Float64(Float64(y / 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 (z_m <= 8.2e+37)
        		tmp = 1.0 / (z_m / x);
        	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[z$95$m, 8.2e+37], N[(1.0 / N[(z$95$m / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z$95$m * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]
        
        \begin{array}{l}
        z\_m = \left|z\right|
        \\
        z\_s = \mathsf{copysign}\left(1, z\right)
        
        \\
        z\_s \cdot \begin{array}{l}
        \mathbf{if}\;z\_m \leq 8.2 \cdot 10^{+37}:\\
        \;\;\;\;\frac{1}{\frac{z\_m}{x}}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{y}{z\_m \cdot y} \cdot x\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < 8.1999999999999996e37

          1. Initial program 96.0%

            \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

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

              \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}} \]
            3. lower-unsound-/.f64N/A

              \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}} \]
            4. lower-unsound-/.f6495.4

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

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

              \[\leadsto \frac{1}{\frac{z}{\color{blue}{\frac{\sin y}{y} \cdot x}}} \]
            7. lower-*.f6495.4

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

            \[\leadsto \color{blue}{\frac{1}{\frac{z}{\frac{\sin y}{y} \cdot x}}} \]
          4. Taylor expanded in y around 0

            \[\leadsto \frac{1}{\color{blue}{\frac{z}{x}}} \]
          5. Step-by-step derivation
            1. lower-/.f6458.5

              \[\leadsto \frac{1}{\frac{z}{\color{blue}{x}}} \]
          6. Applied rewrites58.5%

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

          if 8.1999999999999996e37 < z

          1. Initial program 96.0%

            \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\sin y}{\color{blue}{z \cdot y}} \cdot x \]
            10. lower-*.f6488.0

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

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

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

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

          Alternative 10: 58.7% accurate, 9.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 #s(literal 1 binary64) 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 =     private
          z\_s =     private
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(z_s, x, y, z_m)
          use fmin_fmax_functions
              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 96.0%

            \[\frac{x \cdot \frac{\sin y}{y}}{z} \]
          2. Taylor expanded in y around 0

            \[\leadsto \color{blue}{\frac{x}{z}} \]
          3. Step-by-step derivation
            1. lower-/.f6458.7

              \[\leadsto \frac{x}{\color{blue}{z}} \]
          4. Applied rewrites58.7%

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

          Reproduce

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