(/ (sin (* (* z1 PI) z0)) (* (* (* (* z1 PI) z0) z0) PI))

Percentage Accurate: 42.7% → 78.8%
Time: 2.9s
Alternatives: 11
Speedup: 11.8×

Specification

?
\[\begin{array}{l} t_0 := \left(z1 \cdot \pi\right) \cdot z0\\ \frac{\sin t\_0}{\left(t\_0 \cdot z0\right) \cdot \pi} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (* z1 PI) z0))) (/ (sin t_0) (* (* t_0 z0) PI))))
double code(double z1, double z0) {
	double t_0 = (z1 * ((double) M_PI)) * z0;
	return sin(t_0) / ((t_0 * z0) * ((double) M_PI));
}
public static double code(double z1, double z0) {
	double t_0 = (z1 * Math.PI) * z0;
	return Math.sin(t_0) / ((t_0 * z0) * Math.PI);
}
def code(z1, z0):
	t_0 = (z1 * math.pi) * z0
	return math.sin(t_0) / ((t_0 * z0) * math.pi)
function code(z1, z0)
	t_0 = Float64(Float64(z1 * pi) * z0)
	return Float64(sin(t_0) / Float64(Float64(t_0 * z0) * pi))
end
function tmp = code(z1, z0)
	t_0 = (z1 * pi) * z0;
	tmp = sin(t_0) / ((t_0 * z0) * pi);
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(z1 * Pi), $MachinePrecision] * z0), $MachinePrecision]}, N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(t$95$0 * z0), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(z1 \cdot \pi\right) \cdot z0\\
\frac{\sin t\_0}{\left(t\_0 \cdot z0\right) \cdot \pi}
\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 11 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: 42.7% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left(z1 \cdot \pi\right) \cdot z0\\ \frac{\sin t\_0}{\left(t\_0 \cdot z0\right) \cdot \pi} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (* z1 PI) z0))) (/ (sin t_0) (* (* t_0 z0) PI))))
double code(double z1, double z0) {
	double t_0 = (z1 * ((double) M_PI)) * z0;
	return sin(t_0) / ((t_0 * z0) * ((double) M_PI));
}
public static double code(double z1, double z0) {
	double t_0 = (z1 * Math.PI) * z0;
	return Math.sin(t_0) / ((t_0 * z0) * Math.PI);
}
def code(z1, z0):
	t_0 = (z1 * math.pi) * z0
	return math.sin(t_0) / ((t_0 * z0) * math.pi)
function code(z1, z0)
	t_0 = Float64(Float64(z1 * pi) * z0)
	return Float64(sin(t_0) / Float64(Float64(t_0 * z0) * pi))
end
function tmp = code(z1, z0)
	t_0 = (z1 * pi) * z0;
	tmp = sin(t_0) / ((t_0 * z0) * pi);
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(z1 * Pi), $MachinePrecision] * z0), $MachinePrecision]}, N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(t$95$0 * z0), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(z1 \cdot \pi\right) \cdot z0\\
\frac{\sin t\_0}{\left(t\_0 \cdot z0\right) \cdot \pi}
\end{array}

Alternative 1: 78.8% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\\ t_1 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\ t_2 := \left(t\_1 \cdot \left|z0\right|\right) \cdot \pi\\ t_3 := \frac{\sin t\_1}{t\_2}\\ t_4 := \left|z0\right| \cdot \left|z1\right|\\ \mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq 10^{-174}:\\ \;\;\;\;\frac{\frac{\sin \left(0.5 \cdot \pi - \left(\pi \cdot \left(t\_4 + 0.5\right) + \pi\right)\right) + \sin \left(t\_4 \cdot \pi\right)}{2}}{t\_2}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\frac{\frac{\sin t\_0}{\left|z0\right| \cdot \pi}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \pi}{t\_2}\\ \end{array} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (fabs z0) (* PI (fabs z1))))
       (t_1 (* (* (fabs z1) PI) (fabs z0)))
       (t_2 (* (* t_1 (fabs z0)) PI))
       (t_3 (/ (sin t_1) t_2))
       (t_4 (* (fabs z0) (fabs z1))))
  (*
   (copysign 1.0 z0)
   (if (<= t_3 1e-174)
     (/
      (/
       (+
        (sin (- (* 0.5 PI) (+ (* PI (+ t_4 0.5)) PI)))
        (sin (* t_4 PI)))
       2.0)
      t_2)
     (if (<= t_3 INFINITY)
       (/ (/ (sin t_0) (* (fabs z0) PI)) t_0)
       (/ (sin PI) t_2))))))
double code(double z1, double z0) {
	double t_0 = fabs(z0) * (((double) M_PI) * fabs(z1));
	double t_1 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
	double t_2 = (t_1 * fabs(z0)) * ((double) M_PI);
	double t_3 = sin(t_1) / t_2;
	double t_4 = fabs(z0) * fabs(z1);
	double tmp;
	if (t_3 <= 1e-174) {
		tmp = ((sin(((0.5 * ((double) M_PI)) - ((((double) M_PI) * (t_4 + 0.5)) + ((double) M_PI)))) + sin((t_4 * ((double) M_PI)))) / 2.0) / t_2;
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = (sin(t_0) / (fabs(z0) * ((double) M_PI))) / t_0;
	} else {
		tmp = sin(((double) M_PI)) / t_2;
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double t_0 = Math.abs(z0) * (Math.PI * Math.abs(z1));
	double t_1 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
	double t_2 = (t_1 * Math.abs(z0)) * Math.PI;
	double t_3 = Math.sin(t_1) / t_2;
	double t_4 = Math.abs(z0) * Math.abs(z1);
	double tmp;
	if (t_3 <= 1e-174) {
		tmp = ((Math.sin(((0.5 * Math.PI) - ((Math.PI * (t_4 + 0.5)) + Math.PI))) + Math.sin((t_4 * Math.PI))) / 2.0) / t_2;
	} else if (t_3 <= Double.POSITIVE_INFINITY) {
		tmp = (Math.sin(t_0) / (Math.abs(z0) * Math.PI)) / t_0;
	} else {
		tmp = Math.sin(Math.PI) / t_2;
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	t_0 = math.fabs(z0) * (math.pi * math.fabs(z1))
	t_1 = (math.fabs(z1) * math.pi) * math.fabs(z0)
	t_2 = (t_1 * math.fabs(z0)) * math.pi
	t_3 = math.sin(t_1) / t_2
	t_4 = math.fabs(z0) * math.fabs(z1)
	tmp = 0
	if t_3 <= 1e-174:
		tmp = ((math.sin(((0.5 * math.pi) - ((math.pi * (t_4 + 0.5)) + math.pi))) + math.sin((t_4 * math.pi))) / 2.0) / t_2
	elif t_3 <= math.inf:
		tmp = (math.sin(t_0) / (math.fabs(z0) * math.pi)) / t_0
	else:
		tmp = math.sin(math.pi) / t_2
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	t_0 = Float64(abs(z0) * Float64(pi * abs(z1)))
	t_1 = Float64(Float64(abs(z1) * pi) * abs(z0))
	t_2 = Float64(Float64(t_1 * abs(z0)) * pi)
	t_3 = Float64(sin(t_1) / t_2)
	t_4 = Float64(abs(z0) * abs(z1))
	tmp = 0.0
	if (t_3 <= 1e-174)
		tmp = Float64(Float64(Float64(sin(Float64(Float64(0.5 * pi) - Float64(Float64(pi * Float64(t_4 + 0.5)) + pi))) + sin(Float64(t_4 * pi))) / 2.0) / t_2);
	elseif (t_3 <= Inf)
		tmp = Float64(Float64(sin(t_0) / Float64(abs(z0) * pi)) / t_0);
	else
		tmp = Float64(sin(pi) / t_2);
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	t_0 = abs(z0) * (pi * abs(z1));
	t_1 = (abs(z1) * pi) * abs(z0);
	t_2 = (t_1 * abs(z0)) * pi;
	t_3 = sin(t_1) / t_2;
	t_4 = abs(z0) * abs(z1);
	tmp = 0.0;
	if (t_3 <= 1e-174)
		tmp = ((sin(((0.5 * pi) - ((pi * (t_4 + 0.5)) + pi))) + sin((t_4 * pi))) / 2.0) / t_2;
	elseif (t_3 <= Inf)
		tmp = (sin(t_0) / (abs(z0) * pi)) / t_0;
	else
		tmp = sin(pi) / t_2;
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[Abs[z0], $MachinePrecision] * N[(Pi * N[Abs[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[t$95$1], $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[z0], $MachinePrecision] * N[Abs[z1], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 1e-174], N[(N[(N[(N[Sin[N[(N[(0.5 * Pi), $MachinePrecision] - N[(N[(Pi * N[(t$95$4 + 0.5), $MachinePrecision]), $MachinePrecision] + Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Sin[N[(t$95$4 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / t$95$2), $MachinePrecision]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\\
t_1 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_2 := \left(t\_1 \cdot \left|z0\right|\right) \cdot \pi\\
t_3 := \frac{\sin t\_1}{t\_2}\\
t_4 := \left|z0\right| \cdot \left|z1\right|\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq 10^{-174}:\\
\;\;\;\;\frac{\frac{\sin \left(0.5 \cdot \pi - \left(\pi \cdot \left(t\_4 + 0.5\right) + \pi\right)\right) + \sin \left(t\_4 \cdot \pi\right)}{2}}{t\_2}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\frac{\sin t\_0}{\left|z0\right| \cdot \pi}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{t\_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (sin.f64 (*.f64 (*.f64 z1 (PI.f64)) z0)) (*.f64 (*.f64 (*.f64 (*.f64 z1 (PI.f64)) z0) z0) (PI.f64))) < 1e-174

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot 1}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot 1}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-PI/2N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \color{blue}{\sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. sin-multN/A

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(\left(z1 \cdot \pi\right) \cdot z0 - \frac{\mathsf{PI}\left(\right)}{2}\right) - \cos \left(\left(z1 \cdot \pi\right) \cdot z0 + \frac{\mathsf{PI}\left(\right)}{2}\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(\left(z1 \cdot \pi\right) \cdot z0 - \frac{\mathsf{PI}\left(\right)}{2}\right) - \cos \left(\left(z1 \cdot \pi\right) \cdot z0 + \frac{\mathsf{PI}\left(\right)}{2}\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.7%

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(z0 \cdot \left(\pi \cdot z1\right) - \pi \cdot 0.5\right) - \left(-\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Applied rewrites37.8%

      \[\leadsto \frac{\color{blue}{\frac{\sin \left(0.5 \cdot \pi - \left(\pi \cdot \left(z0 \cdot z1 + 0.5\right) + \pi\right)\right) + \sin \left(\left(z0 \cdot z1\right) \cdot \pi\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]

    if 1e-174 < (/.f64 (sin.f64 (*.f64 (*.f64 z1 (PI.f64)) z0)) (*.f64 (*.f64 (*.f64 (*.f64 z1 (PI.f64)) z0) z0) (PI.f64))) < +inf.0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right)} \cdot \pi} \]
      4. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \left(z0 \cdot \pi\right)}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(z0 \cdot \pi\right) \cdot \left(\left(z1 \cdot \pi\right) \cdot z0\right)}} \]
      6. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0}} \]
      8. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{z0 \cdot \pi}}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\frac{\sin \color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right)}}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      10. *-commutativeN/A

        \[\leadsto \frac{\frac{\sin \color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)}}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{\frac{\sin \color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)}}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      12. lift-*.f64N/A

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \color{blue}{\left(z1 \cdot \pi\right)}\right)}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      13. *-commutativeN/A

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right)}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right)}{z0 \cdot \pi}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      15. lower-*.f6453.7%

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{\color{blue}{z0 \cdot \pi}}}{\left(z1 \cdot \pi\right) \cdot z0} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{z0 \cdot \pi}}{\color{blue}{\left(z1 \cdot \pi\right) \cdot z0}} \]
      17. *-commutativeN/A

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{z0 \cdot \pi}}{\color{blue}{z0 \cdot \left(z1 \cdot \pi\right)}} \]
      18. lower-*.f6453.7%

        \[\leadsto \frac{\frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{z0 \cdot \pi}}{\color{blue}{z0 \cdot \left(z1 \cdot \pi\right)}} \]
    3. Applied rewrites53.7%

      \[\leadsto \color{blue}{\frac{\frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{z0 \cdot \pi}}{z0 \cdot \left(\pi \cdot z1\right)}} \]

    if +inf.0 < (/.f64 (sin.f64 (*.f64 (*.f64 z1 (PI.f64)) z0)) (*.f64 (*.f64 (*.f64 (*.f64 z1 (PI.f64)) z0) z0) (PI.f64)))

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-neg-revN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\sin \left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)}\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. cos-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\cos \left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. sin-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      6. lower-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sin \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.5%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(-z1\right) \cdot \left(z0 \cdot \pi\right) + \pi \cdot 0.5\right) + \pi \cdot 0.5\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-PI.f6429.5%

        \[\leadsto \frac{\sin \pi}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 72.8% accurate, 0.4× speedup?

\[\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 8.6 \cdot 10^{-7}:\\ \;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\log \left(e^{\pi \cdot \left|z0\right|}\right)}\\ \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (*
 (copysign 1.0 z0)
 (if (<= (fabs z0) 8.6e-7)
   (/ 1.0 (* (fabs z0) PI))
   (/ 1.0 (log (exp (* PI (fabs z0))))))))
double code(double z1, double z0) {
	double tmp;
	if (fabs(z0) <= 8.6e-7) {
		tmp = 1.0 / (fabs(z0) * ((double) M_PI));
	} else {
		tmp = 1.0 / log(exp((((double) M_PI) * fabs(z0))));
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double tmp;
	if (Math.abs(z0) <= 8.6e-7) {
		tmp = 1.0 / (Math.abs(z0) * Math.PI);
	} else {
		tmp = 1.0 / Math.log(Math.exp((Math.PI * Math.abs(z0))));
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	tmp = 0
	if math.fabs(z0) <= 8.6e-7:
		tmp = 1.0 / (math.fabs(z0) * math.pi)
	else:
		tmp = 1.0 / math.log(math.exp((math.pi * math.fabs(z0))))
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	tmp = 0.0
	if (abs(z0) <= 8.6e-7)
		tmp = Float64(1.0 / Float64(abs(z0) * pi));
	else
		tmp = Float64(1.0 / log(exp(Float64(pi * abs(z0)))));
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	tmp = 0.0;
	if (abs(z0) <= 8.6e-7)
		tmp = 1.0 / (abs(z0) * pi);
	else
		tmp = 1.0 / log(exp((pi * abs(z0))));
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 8.6e-7], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Log[N[Exp[N[(Pi * N[Abs[z0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 8.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\log \left(e^{\pi \cdot \left|z0\right|}\right)}\\


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

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 8.6000000000000002e-7 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\pi}} \]
      2. lift-PI.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \mathsf{PI}\left(\right)} \]
      3. add-log-expN/A

        \[\leadsto \frac{1}{z0 \cdot \log \left(e^{\mathsf{PI}\left(\right)}\right)} \]
      4. log-pow-revN/A

        \[\leadsto \frac{1}{\log \left({\left(e^{\mathsf{PI}\left(\right)}\right)}^{z0}\right)} \]
      5. lower-log.f64N/A

        \[\leadsto \frac{1}{\log \left({\left(e^{\mathsf{PI}\left(\right)}\right)}^{z0}\right)} \]
      6. lift-PI.f64N/A

        \[\leadsto \frac{1}{\log \left({\left(e^{\pi}\right)}^{z0}\right)} \]
      7. pow-expN/A

        \[\leadsto \frac{1}{\log \left(e^{\pi \cdot z0}\right)} \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\log \left(e^{z0 \cdot \pi}\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{1}{\log \left(e^{z0 \cdot \pi}\right)} \]
      10. lower-exp.f6438.3%

        \[\leadsto \frac{1}{\log \left(e^{z0 \cdot \pi}\right)} \]
      11. lift-*.f64N/A

        \[\leadsto \frac{1}{\log \left(e^{z0 \cdot \pi}\right)} \]
      12. *-commutativeN/A

        \[\leadsto \frac{1}{\log \left(e^{\pi \cdot z0}\right)} \]
      13. lower-*.f6438.3%

        \[\leadsto \frac{1}{\log \left(e^{\pi \cdot z0}\right)} \]
    6. Applied rewrites38.3%

      \[\leadsto \frac{1}{\log \left(e^{\pi \cdot z0}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 70.0% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\\ \mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 3.7 \cdot 10^{-53}:\\ \;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\ \mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\ \;\;\;\;\frac{\sin t\_0}{\pi} \cdot \frac{1}{t\_0 \cdot \left|z0\right|}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\ \end{array} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (fabs z0) (* PI (fabs z1)))))
  (*
   (copysign 1.0 z0)
   (if (<= (fabs z0) 3.7e-53)
     (/ 1.0 (* (fabs z0) PI))
     (if (<= (fabs z0) 3.5e+152)
       (* (/ (sin t_0) PI) (/ 1.0 (* t_0 (fabs z0))))
       (/
        (* 0.5 (cos (- (* 0.5 PI))))
        (* (* (* (* (fabs z1) PI) (fabs z0)) (fabs z0)) PI)))))))
double code(double z1, double z0) {
	double t_0 = fabs(z0) * (((double) M_PI) * fabs(z1));
	double tmp;
	if (fabs(z0) <= 3.7e-53) {
		tmp = 1.0 / (fabs(z0) * ((double) M_PI));
	} else if (fabs(z0) <= 3.5e+152) {
		tmp = (sin(t_0) / ((double) M_PI)) * (1.0 / (t_0 * fabs(z0)));
	} else {
		tmp = (0.5 * cos(-(0.5 * ((double) M_PI)))) / ((((fabs(z1) * ((double) M_PI)) * fabs(z0)) * fabs(z0)) * ((double) M_PI));
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double t_0 = Math.abs(z0) * (Math.PI * Math.abs(z1));
	double tmp;
	if (Math.abs(z0) <= 3.7e-53) {
		tmp = 1.0 / (Math.abs(z0) * Math.PI);
	} else if (Math.abs(z0) <= 3.5e+152) {
		tmp = (Math.sin(t_0) / Math.PI) * (1.0 / (t_0 * Math.abs(z0)));
	} else {
		tmp = (0.5 * Math.cos(-(0.5 * Math.PI))) / ((((Math.abs(z1) * Math.PI) * Math.abs(z0)) * Math.abs(z0)) * Math.PI);
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	t_0 = math.fabs(z0) * (math.pi * math.fabs(z1))
	tmp = 0
	if math.fabs(z0) <= 3.7e-53:
		tmp = 1.0 / (math.fabs(z0) * math.pi)
	elif math.fabs(z0) <= 3.5e+152:
		tmp = (math.sin(t_0) / math.pi) * (1.0 / (t_0 * math.fabs(z0)))
	else:
		tmp = (0.5 * math.cos(-(0.5 * math.pi))) / ((((math.fabs(z1) * math.pi) * math.fabs(z0)) * math.fabs(z0)) * math.pi)
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	t_0 = Float64(abs(z0) * Float64(pi * abs(z1)))
	tmp = 0.0
	if (abs(z0) <= 3.7e-53)
		tmp = Float64(1.0 / Float64(abs(z0) * pi));
	elseif (abs(z0) <= 3.5e+152)
		tmp = Float64(Float64(sin(t_0) / pi) * Float64(1.0 / Float64(t_0 * abs(z0))));
	else
		tmp = Float64(Float64(0.5 * cos(Float64(-Float64(0.5 * pi)))) / Float64(Float64(Float64(Float64(abs(z1) * pi) * abs(z0)) * abs(z0)) * pi));
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	t_0 = abs(z0) * (pi * abs(z1));
	tmp = 0.0;
	if (abs(z0) <= 3.7e-53)
		tmp = 1.0 / (abs(z0) * pi);
	elseif (abs(z0) <= 3.5e+152)
		tmp = (sin(t_0) / pi) * (1.0 / (t_0 * abs(z0)));
	else
		tmp = (0.5 * cos(-(0.5 * pi))) / ((((abs(z1) * pi) * abs(z0)) * abs(z0)) * pi);
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[Abs[z0], $MachinePrecision] * N[(Pi * N[Abs[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 3.7e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[(N[Sin[t$95$0], $MachinePrecision] / Pi), $MachinePrecision] * N[(1.0 / N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Cos[(-N[(0.5 * Pi), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 3.7 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\

\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{\pi} \cdot \frac{1}{t\_0 \cdot \left|z0\right|}\\

\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z0 < 3.6999999999999998e-53

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 3.6999999999999998e-53 < z0 < 3.4999999999999998e152

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\pi \cdot \left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right)}} \]
      4. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\pi}}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0}} \]
      5. mult-flipN/A

        \[\leadsto \color{blue}{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\pi}} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\sin \color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right)}}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0} \]
      9. *-commutativeN/A

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

        \[\leadsto \frac{\sin \color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)}}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0} \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(z0 \cdot \color{blue}{\left(z1 \cdot \pi\right)}\right)}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0} \]
      12. *-commutativeN/A

        \[\leadsto \frac{\sin \left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right)}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{\sin \left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right)}{\pi} \cdot \frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0} \]
      14. lower-/.f6441.7%

        \[\leadsto \frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{\pi} \cdot \color{blue}{\frac{1}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0}} \]
    3. Applied rewrites41.7%

      \[\leadsto \color{blue}{\frac{\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)}{\pi} \cdot \frac{1}{\left(z0 \cdot \left(\pi \cdot z1\right)\right) \cdot z0}} \]

    if 3.4999999999999998e152 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot 1}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot 1}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-PI/2N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \color{blue}{\sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. sin-multN/A

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(\left(z1 \cdot \pi\right) \cdot z0 - \frac{\mathsf{PI}\left(\right)}{2}\right) - \cos \left(\left(z1 \cdot \pi\right) \cdot z0 + \frac{\mathsf{PI}\left(\right)}{2}\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(\left(z1 \cdot \pi\right) \cdot z0 - \frac{\mathsf{PI}\left(\right)}{2}\right) - \cos \left(\left(z1 \cdot \pi\right) \cdot z0 + \frac{\mathsf{PI}\left(\right)}{2}\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.7%

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(z0 \cdot \left(\pi \cdot z1\right) - \pi \cdot 0.5\right) - \left(-\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \pi\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \color{blue}{\cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lower-cos.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. lower-neg.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \cos \left(-\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \cos \left(-\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. lower-PI.f6429.5%

        \[\leadsto \frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\color{blue}{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 70.0% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\ t_1 := \left(t\_0 \cdot \left|z0\right|\right) \cdot \pi\\ \mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\ \;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\ \mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\ \;\;\;\;\frac{\sin t\_0}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{t\_1}\\ \end{array} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (* (fabs z1) PI) (fabs z0)))
       (t_1 (* (* t_0 (fabs z0)) PI)))
  (*
   (copysign 1.0 z0)
   (if (<= (fabs z0) 1.6e-53)
     (/ 1.0 (* (fabs z0) PI))
     (if (<= (fabs z0) 3.5e+152)
       (/ (sin t_0) t_1)
       (/ (* 0.5 (cos (- (* 0.5 PI)))) t_1))))))
double code(double z1, double z0) {
	double t_0 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
	double t_1 = (t_0 * fabs(z0)) * ((double) M_PI);
	double tmp;
	if (fabs(z0) <= 1.6e-53) {
		tmp = 1.0 / (fabs(z0) * ((double) M_PI));
	} else if (fabs(z0) <= 3.5e+152) {
		tmp = sin(t_0) / t_1;
	} else {
		tmp = (0.5 * cos(-(0.5 * ((double) M_PI)))) / t_1;
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double t_0 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
	double t_1 = (t_0 * Math.abs(z0)) * Math.PI;
	double tmp;
	if (Math.abs(z0) <= 1.6e-53) {
		tmp = 1.0 / (Math.abs(z0) * Math.PI);
	} else if (Math.abs(z0) <= 3.5e+152) {
		tmp = Math.sin(t_0) / t_1;
	} else {
		tmp = (0.5 * Math.cos(-(0.5 * Math.PI))) / t_1;
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	t_0 = (math.fabs(z1) * math.pi) * math.fabs(z0)
	t_1 = (t_0 * math.fabs(z0)) * math.pi
	tmp = 0
	if math.fabs(z0) <= 1.6e-53:
		tmp = 1.0 / (math.fabs(z0) * math.pi)
	elif math.fabs(z0) <= 3.5e+152:
		tmp = math.sin(t_0) / t_1
	else:
		tmp = (0.5 * math.cos(-(0.5 * math.pi))) / t_1
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	t_0 = Float64(Float64(abs(z1) * pi) * abs(z0))
	t_1 = Float64(Float64(t_0 * abs(z0)) * pi)
	tmp = 0.0
	if (abs(z0) <= 1.6e-53)
		tmp = Float64(1.0 / Float64(abs(z0) * pi));
	elseif (abs(z0) <= 3.5e+152)
		tmp = Float64(sin(t_0) / t_1);
	else
		tmp = Float64(Float64(0.5 * cos(Float64(-Float64(0.5 * pi)))) / t_1);
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	t_0 = (abs(z1) * pi) * abs(z0);
	t_1 = (t_0 * abs(z0)) * pi;
	tmp = 0.0;
	if (abs(z0) <= 1.6e-53)
		tmp = 1.0 / (abs(z0) * pi);
	elseif (abs(z0) <= 3.5e+152)
		tmp = sin(t_0) / t_1;
	else
		tmp = (0.5 * cos(-(0.5 * pi))) / t_1;
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(0.5 * N[Cos[(-N[(0.5 * Pi), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_1 := \left(t\_0 \cdot \left|z0\right|\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\

\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{t\_1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z0 < 1.6e-53

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 1.6e-53 < z0 < 3.4999999999999998e152

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]

    if 3.4999999999999998e152 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. *-rgt-identityN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot 1}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot 1}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-PI/2N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \color{blue}{\sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. sin-multN/A

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(\left(z1 \cdot \pi\right) \cdot z0 - \frac{\mathsf{PI}\left(\right)}{2}\right) - \cos \left(\left(z1 \cdot \pi\right) \cdot z0 + \frac{\mathsf{PI}\left(\right)}{2}\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\cos \left(\left(z1 \cdot \pi\right) \cdot z0 - \frac{\mathsf{PI}\left(\right)}{2}\right) - \cos \left(\left(z1 \cdot \pi\right) \cdot z0 + \frac{\mathsf{PI}\left(\right)}{2}\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.7%

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(z0 \cdot \left(\pi \cdot z1\right) - \pi \cdot 0.5\right) - \left(-\sin \left(z0 \cdot \left(\pi \cdot z1\right)\right)\right)}{2}}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \pi\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \color{blue}{\cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lower-cos.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \cos \left(\mathsf{neg}\left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. lower-neg.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \cos \left(-\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\frac{1}{2} \cdot \cos \left(-\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. lower-PI.f6429.5%

        \[\leadsto \frac{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\color{blue}{0.5 \cdot \cos \left(-0.5 \cdot \pi\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 70.0% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\ t_1 := \left(t\_0 \cdot \left|z0\right|\right) \cdot \pi\\ \mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\ \;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\ \mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\ \;\;\;\;\frac{\sin t\_0}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \pi}{t\_1}\\ \end{array} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (* (fabs z1) PI) (fabs z0)))
       (t_1 (* (* t_0 (fabs z0)) PI)))
  (*
   (copysign 1.0 z0)
   (if (<= (fabs z0) 1.6e-53)
     (/ 1.0 (* (fabs z0) PI))
     (if (<= (fabs z0) 3.5e+152)
       (/ (sin t_0) t_1)
       (/ (sin PI) t_1))))))
double code(double z1, double z0) {
	double t_0 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
	double t_1 = (t_0 * fabs(z0)) * ((double) M_PI);
	double tmp;
	if (fabs(z0) <= 1.6e-53) {
		tmp = 1.0 / (fabs(z0) * ((double) M_PI));
	} else if (fabs(z0) <= 3.5e+152) {
		tmp = sin(t_0) / t_1;
	} else {
		tmp = sin(((double) M_PI)) / t_1;
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double t_0 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
	double t_1 = (t_0 * Math.abs(z0)) * Math.PI;
	double tmp;
	if (Math.abs(z0) <= 1.6e-53) {
		tmp = 1.0 / (Math.abs(z0) * Math.PI);
	} else if (Math.abs(z0) <= 3.5e+152) {
		tmp = Math.sin(t_0) / t_1;
	} else {
		tmp = Math.sin(Math.PI) / t_1;
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	t_0 = (math.fabs(z1) * math.pi) * math.fabs(z0)
	t_1 = (t_0 * math.fabs(z0)) * math.pi
	tmp = 0
	if math.fabs(z0) <= 1.6e-53:
		tmp = 1.0 / (math.fabs(z0) * math.pi)
	elif math.fabs(z0) <= 3.5e+152:
		tmp = math.sin(t_0) / t_1
	else:
		tmp = math.sin(math.pi) / t_1
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	t_0 = Float64(Float64(abs(z1) * pi) * abs(z0))
	t_1 = Float64(Float64(t_0 * abs(z0)) * pi)
	tmp = 0.0
	if (abs(z0) <= 1.6e-53)
		tmp = Float64(1.0 / Float64(abs(z0) * pi));
	elseif (abs(z0) <= 3.5e+152)
		tmp = Float64(sin(t_0) / t_1);
	else
		tmp = Float64(sin(pi) / t_1);
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	t_0 = (abs(z1) * pi) * abs(z0);
	t_1 = (t_0 * abs(z0)) * pi;
	tmp = 0.0;
	if (abs(z0) <= 1.6e-53)
		tmp = 1.0 / (abs(z0) * pi);
	elseif (abs(z0) <= 3.5e+152)
		tmp = sin(t_0) / t_1;
	else
		tmp = sin(pi) / t_1;
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / t$95$1), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_1 := \left(t\_0 \cdot \left|z0\right|\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\

\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{t\_1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z0 < 1.6e-53

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 1.6e-53 < z0 < 3.4999999999999998e152

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]

    if 3.4999999999999998e152 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-neg-revN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\sin \left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)}\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. cos-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\cos \left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. sin-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      6. lower-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sin \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.5%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(-z1\right) \cdot \left(z0 \cdot \pi\right) + \pi \cdot 0.5\right) + \pi \cdot 0.5\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-PI.f6429.5%

        \[\leadsto \frac{\sin \pi}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 70.0% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\ t_1 := \left|z0\right| \cdot \pi\\ \mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\ \;\;\;\;\frac{1}{t\_1}\\ \mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\ \;\;\;\;\frac{\sin t\_0}{\left(\left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\right) \cdot t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \pi}{\left(t\_0 \cdot \left|z0\right|\right) \cdot \pi}\\ \end{array} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (* (fabs z1) PI) (fabs z0))) (t_1 (* (fabs z0) PI)))
  (*
   (copysign 1.0 z0)
   (if (<= (fabs z0) 1.6e-53)
     (/ 1.0 t_1)
     (if (<= (fabs z0) 3.5e+152)
       (/ (sin t_0) (* (* (fabs z0) (* PI (fabs z1))) t_1))
       (/ (sin PI) (* (* t_0 (fabs z0)) PI)))))))
double code(double z1, double z0) {
	double t_0 = (fabs(z1) * ((double) M_PI)) * fabs(z0);
	double t_1 = fabs(z0) * ((double) M_PI);
	double tmp;
	if (fabs(z0) <= 1.6e-53) {
		tmp = 1.0 / t_1;
	} else if (fabs(z0) <= 3.5e+152) {
		tmp = sin(t_0) / ((fabs(z0) * (((double) M_PI) * fabs(z1))) * t_1);
	} else {
		tmp = sin(((double) M_PI)) / ((t_0 * fabs(z0)) * ((double) M_PI));
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double t_0 = (Math.abs(z1) * Math.PI) * Math.abs(z0);
	double t_1 = Math.abs(z0) * Math.PI;
	double tmp;
	if (Math.abs(z0) <= 1.6e-53) {
		tmp = 1.0 / t_1;
	} else if (Math.abs(z0) <= 3.5e+152) {
		tmp = Math.sin(t_0) / ((Math.abs(z0) * (Math.PI * Math.abs(z1))) * t_1);
	} else {
		tmp = Math.sin(Math.PI) / ((t_0 * Math.abs(z0)) * Math.PI);
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	t_0 = (math.fabs(z1) * math.pi) * math.fabs(z0)
	t_1 = math.fabs(z0) * math.pi
	tmp = 0
	if math.fabs(z0) <= 1.6e-53:
		tmp = 1.0 / t_1
	elif math.fabs(z0) <= 3.5e+152:
		tmp = math.sin(t_0) / ((math.fabs(z0) * (math.pi * math.fabs(z1))) * t_1)
	else:
		tmp = math.sin(math.pi) / ((t_0 * math.fabs(z0)) * math.pi)
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	t_0 = Float64(Float64(abs(z1) * pi) * abs(z0))
	t_1 = Float64(abs(z0) * pi)
	tmp = 0.0
	if (abs(z0) <= 1.6e-53)
		tmp = Float64(1.0 / t_1);
	elseif (abs(z0) <= 3.5e+152)
		tmp = Float64(sin(t_0) / Float64(Float64(abs(z0) * Float64(pi * abs(z1))) * t_1));
	else
		tmp = Float64(sin(pi) / Float64(Float64(t_0 * abs(z0)) * pi));
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	t_0 = (abs(z1) * pi) * abs(z0);
	t_1 = abs(z0) * pi;
	tmp = 0.0;
	if (abs(z0) <= 1.6e-53)
		tmp = 1.0 / t_1;
	elseif (abs(z0) <= 3.5e+152)
		tmp = sin(t_0) / ((abs(z0) * (pi * abs(z1))) * t_1);
	else
		tmp = sin(pi) / ((t_0 * abs(z0)) * pi);
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / t$95$1), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(N[Abs[z0], $MachinePrecision] * N[(Pi * N[Abs[z1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\\
t_1 := \left|z0\right| \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{t\_1}\\

\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{\left(\left|z0\right| \cdot \left(\pi \cdot \left|z1\right|\right)\right) \cdot t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{\left(t\_0 \cdot \left|z0\right|\right) \cdot \pi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z0 < 1.6e-53

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 1.6e-53 < z0 < 3.4999999999999998e152

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right)} \cdot \pi} \]
      3. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \left(z0 \cdot \pi\right)}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \left(z0 \cdot \pi\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot \left(z0 \cdot \pi\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)} \cdot \left(z0 \cdot \pi\right)} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)} \cdot \left(z0 \cdot \pi\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(z0 \cdot \color{blue}{\left(z1 \cdot \pi\right)}\right) \cdot \left(z0 \cdot \pi\right)} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right) \cdot \left(z0 \cdot \pi\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right) \cdot \left(z0 \cdot \pi\right)} \]
      11. lower-*.f6442.7%

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(z0 \cdot \left(\pi \cdot z1\right)\right) \cdot \color{blue}{\left(z0 \cdot \pi\right)}} \]
    3. Applied rewrites42.7%

      \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(z0 \cdot \left(\pi \cdot z1\right)\right) \cdot \left(z0 \cdot \pi\right)}} \]

    if 3.4999999999999998e152 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-neg-revN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\sin \left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)}\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. cos-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\cos \left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. sin-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      6. lower-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sin \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.5%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(-z1\right) \cdot \left(z0 \cdot \pi\right) + \pi \cdot 0.5\right) + \pi \cdot 0.5\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-PI.f6429.5%

        \[\leadsto \frac{\sin \pi}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 69.8% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := \left(\left|z0\right| \cdot \left|z1\right|\right) \cdot \pi\\ \mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\ \;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\ \mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\ \;\;\;\;\frac{\sin t\_0}{\left(t\_0 \cdot \left|z0\right|\right) \cdot \pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \pi}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\ \end{array} \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (let* ((t_0 (* (* (fabs z0) (fabs z1)) PI)))
  (*
   (copysign 1.0 z0)
   (if (<= (fabs z0) 1.6e-53)
     (/ 1.0 (* (fabs z0) PI))
     (if (<= (fabs z0) 3.5e+152)
       (/ (sin t_0) (* (* t_0 (fabs z0)) PI))
       (/
        (sin PI)
        (* (* (* (* (fabs z1) PI) (fabs z0)) (fabs z0)) PI)))))))
double code(double z1, double z0) {
	double t_0 = (fabs(z0) * fabs(z1)) * ((double) M_PI);
	double tmp;
	if (fabs(z0) <= 1.6e-53) {
		tmp = 1.0 / (fabs(z0) * ((double) M_PI));
	} else if (fabs(z0) <= 3.5e+152) {
		tmp = sin(t_0) / ((t_0 * fabs(z0)) * ((double) M_PI));
	} else {
		tmp = sin(((double) M_PI)) / ((((fabs(z1) * ((double) M_PI)) * fabs(z0)) * fabs(z0)) * ((double) M_PI));
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double t_0 = (Math.abs(z0) * Math.abs(z1)) * Math.PI;
	double tmp;
	if (Math.abs(z0) <= 1.6e-53) {
		tmp = 1.0 / (Math.abs(z0) * Math.PI);
	} else if (Math.abs(z0) <= 3.5e+152) {
		tmp = Math.sin(t_0) / ((t_0 * Math.abs(z0)) * Math.PI);
	} else {
		tmp = Math.sin(Math.PI) / ((((Math.abs(z1) * Math.PI) * Math.abs(z0)) * Math.abs(z0)) * Math.PI);
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	t_0 = (math.fabs(z0) * math.fabs(z1)) * math.pi
	tmp = 0
	if math.fabs(z0) <= 1.6e-53:
		tmp = 1.0 / (math.fabs(z0) * math.pi)
	elif math.fabs(z0) <= 3.5e+152:
		tmp = math.sin(t_0) / ((t_0 * math.fabs(z0)) * math.pi)
	else:
		tmp = math.sin(math.pi) / ((((math.fabs(z1) * math.pi) * math.fabs(z0)) * math.fabs(z0)) * math.pi)
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	t_0 = Float64(Float64(abs(z0) * abs(z1)) * pi)
	tmp = 0.0
	if (abs(z0) <= 1.6e-53)
		tmp = Float64(1.0 / Float64(abs(z0) * pi));
	elseif (abs(z0) <= 3.5e+152)
		tmp = Float64(sin(t_0) / Float64(Float64(t_0 * abs(z0)) * pi));
	else
		tmp = Float64(sin(pi) / Float64(Float64(Float64(Float64(abs(z1) * pi) * abs(z0)) * abs(z0)) * pi));
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	t_0 = (abs(z0) * abs(z1)) * pi;
	tmp = 0.0;
	if (abs(z0) <= 1.6e-53)
		tmp = 1.0 / (abs(z0) * pi);
	elseif (abs(z0) <= 3.5e+152)
		tmp = sin(t_0) / ((t_0 * abs(z0)) * pi);
	else
		tmp = sin(pi) / ((((abs(z1) * pi) * abs(z0)) * abs(z0)) * pi);
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := Block[{t$95$0 = N[(N[(N[Abs[z0], $MachinePrecision] * N[Abs[z1], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 1.6e-53], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z0], $MachinePrecision], 3.5e+152], N[(N[Sin[t$95$0], $MachinePrecision] / N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / N[(N[(N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(\left|z0\right| \cdot \left|z1\right|\right) \cdot \pi\\
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 1.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\

\mathbf{elif}\;\left|z0\right| \leq 3.5 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sin t\_0}{\left(t\_0 \cdot \left|z0\right|\right) \cdot \pi}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z0 < 1.6e-53

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 1.6e-53 < z0 < 3.4999999999999998e152

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right)} \cdot \pi} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(z0 \cdot \left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)} \cdot \pi} \]
      4. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{z0 \cdot \left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \pi\right)}} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \pi\right) \cdot z0}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \pi\right) \cdot z0}} \]
      7. lower-*.f6442.7%

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \pi\right)} \cdot z0} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot \pi\right) \cdot z0} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)} \cdot \pi\right) \cdot z0} \]
      10. lower-*.f6442.7%

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(z0 \cdot \left(z1 \cdot \pi\right)\right)} \cdot \pi\right) \cdot z0} \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(z0 \cdot \color{blue}{\left(z1 \cdot \pi\right)}\right) \cdot \pi\right) \cdot z0} \]
      12. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right) \cdot \pi\right) \cdot z0} \]
      13. lower-*.f6442.7%

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(z0 \cdot \color{blue}{\left(\pi \cdot z1\right)}\right) \cdot \pi\right) \cdot z0} \]
    3. Applied rewrites42.7%

      \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z0 \cdot \left(\pi \cdot z1\right)\right) \cdot \pi\right) \cdot z0}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(z0 \cdot \left(\pi \cdot z1\right)\right)} \cdot \pi\right) \cdot z0} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(\left(\pi \cdot z1\right) \cdot z0\right)} \cdot \pi\right) \cdot z0} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\color{blue}{\left(\pi \cdot z1\right)} \cdot z0\right) \cdot \pi\right) \cdot z0} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\color{blue}{\left(z1 \cdot \pi\right)} \cdot z0\right) \cdot \pi\right) \cdot z0} \]
      5. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(z1 \cdot \left(\pi \cdot z0\right)\right)} \cdot \pi\right) \cdot z0} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(z1 \cdot \color{blue}{\left(z0 \cdot \pi\right)}\right) \cdot \pi\right) \cdot z0} \]
      7. associate-*r*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(\left(z1 \cdot z0\right) \cdot \pi\right)} \cdot \pi\right) \cdot z0} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(\left(z1 \cdot z0\right) \cdot \pi\right)} \cdot \pi\right) \cdot z0} \]
      9. lower-*.f6442.6%

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\color{blue}{\left(z1 \cdot z0\right)} \cdot \pi\right) \cdot \pi\right) \cdot z0} \]
    5. Applied rewrites42.6%

      \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(\left(z1 \cdot z0\right) \cdot \pi\right)} \cdot \pi\right) \cdot z0} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot z0\right) \cdot \pi\right) \cdot \pi\right) \cdot z0}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot z0\right) \cdot \pi\right) \cdot \pi\right)} \cdot z0} \]
      3. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot z0\right) \cdot \pi\right) \cdot \left(\pi \cdot z0\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot z0\right) \cdot \pi\right)} \cdot \left(\pi \cdot z0\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(z1 \cdot z0\right)} \cdot \pi\right) \cdot \left(\pi \cdot z0\right)} \]
      6. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(z1 \cdot \left(z0 \cdot \pi\right)\right)} \cdot \left(\pi \cdot z0\right)} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(z1 \cdot \color{blue}{\left(\pi \cdot z0\right)}\right) \cdot \left(\pi \cdot z0\right)} \]
      8. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot \left(\pi \cdot z0\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\color{blue}{\left(z1 \cdot \pi\right)} \cdot z0\right) \cdot \left(\pi \cdot z0\right)} \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(z1 \cdot \pi\right) \cdot z0\right)} \cdot \left(\pi \cdot z0\right)} \]
      11. *-commutativeN/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot \color{blue}{\left(z0 \cdot \pi\right)}} \]
      12. associate-*l*N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right)} \cdot \pi} \]
      14. lift-*.f6442.7%

        \[\leadsto \frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\color{blue}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi}} \]
    7. Applied rewrites42.7%

      \[\leadsto \color{blue}{\frac{\sin \left(\left(z0 \cdot z1\right) \cdot \pi\right)}{\left(\left(\left(z0 \cdot z1\right) \cdot \pi\right) \cdot z0\right) \cdot \pi}} \]

    if 3.4999999999999998e152 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-neg-revN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\sin \left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)}\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. cos-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\cos \left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. sin-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      6. lower-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sin \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.5%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(-z1\right) \cdot \left(z0 \cdot \pi\right) + \pi \cdot 0.5\right) + \pi \cdot 0.5\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-PI.f6429.5%

        \[\leadsto \frac{\sin \pi}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 67.4% accurate, 0.6× speedup?

\[\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l} \mathbf{if}\;\left|z0\right| \leq 3 \cdot 10^{+63}:\\ \;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \pi}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\ \end{array} \]
(FPCore (z1 z0)
  :precision binary64
  (*
 (copysign 1.0 z0)
 (if (<= (fabs z0) 3e+63)
   (/ 1.0 (* (fabs z0) PI))
   (/ (sin PI) (* (* (* (* (fabs z1) PI) (fabs z0)) (fabs z0)) PI)))))
double code(double z1, double z0) {
	double tmp;
	if (fabs(z0) <= 3e+63) {
		tmp = 1.0 / (fabs(z0) * ((double) M_PI));
	} else {
		tmp = sin(((double) M_PI)) / ((((fabs(z1) * ((double) M_PI)) * fabs(z0)) * fabs(z0)) * ((double) M_PI));
	}
	return copysign(1.0, z0) * tmp;
}
public static double code(double z1, double z0) {
	double tmp;
	if (Math.abs(z0) <= 3e+63) {
		tmp = 1.0 / (Math.abs(z0) * Math.PI);
	} else {
		tmp = Math.sin(Math.PI) / ((((Math.abs(z1) * Math.PI) * Math.abs(z0)) * Math.abs(z0)) * Math.PI);
	}
	return Math.copySign(1.0, z0) * tmp;
}
def code(z1, z0):
	tmp = 0
	if math.fabs(z0) <= 3e+63:
		tmp = 1.0 / (math.fabs(z0) * math.pi)
	else:
		tmp = math.sin(math.pi) / ((((math.fabs(z1) * math.pi) * math.fabs(z0)) * math.fabs(z0)) * math.pi)
	return math.copysign(1.0, z0) * tmp
function code(z1, z0)
	tmp = 0.0
	if (abs(z0) <= 3e+63)
		tmp = Float64(1.0 / Float64(abs(z0) * pi));
	else
		tmp = Float64(sin(pi) / Float64(Float64(Float64(Float64(abs(z1) * pi) * abs(z0)) * abs(z0)) * pi));
	end
	return Float64(copysign(1.0, z0) * tmp)
end
function tmp_2 = code(z1, z0)
	tmp = 0.0;
	if (abs(z0) <= 3e+63)
		tmp = 1.0 / (abs(z0) * pi);
	else
		tmp = sin(pi) / ((((abs(z1) * pi) * abs(z0)) * abs(z0)) * pi);
	end
	tmp_2 = (sign(z0) * abs(1.0)) * tmp;
end
code[z1_, z0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[z0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[z0], $MachinePrecision], 3e+63], N[(1.0 / N[(N[Abs[z0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], N[(N[Sin[Pi], $MachinePrecision] / N[(N[(N[(N[(N[Abs[z1], $MachinePrecision] * Pi), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, z0\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|z0\right| \leq 3 \cdot 10^{+63}:\\
\;\;\;\;\frac{1}{\left|z0\right| \cdot \pi}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin \pi}{\left(\left(\left(\left|z1\right| \cdot \pi\right) \cdot \left|z0\right|\right) \cdot \left|z0\right|\right) \cdot \pi}\\


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

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Taylor expanded in z1 around 0

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
      3. lower-PI.f6451.7%

        \[\leadsto \frac{1}{z0 \cdot \pi} \]
    4. Applied rewrites51.7%

      \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]

    if 3e63 < z0

    1. Initial program 42.7%

      \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    2. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)\right)\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      2. lift-sin.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}\right)\right)\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      3. sin-neg-revN/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\sin \left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right)}\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      4. cos-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\cos \left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      5. sin-+PI/2-revN/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      6. lower-sin.f64N/A

        \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
      7. lower-+.f64N/A

        \[\leadsto \frac{\sin \color{blue}{\left(\left(\left(\mathsf{neg}\left(\left(z1 \cdot \pi\right) \cdot z0\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    3. Applied rewrites18.5%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(\left(-z1\right) \cdot \left(z0 \cdot \pi\right) + \pi \cdot 0.5\right) + \pi \cdot 0.5\right)}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    4. Taylor expanded in z1 around 0

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    5. Step-by-step derivation
      1. lower-PI.f6429.5%

        \[\leadsto \frac{\sin \pi}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
    6. Applied rewrites29.5%

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 51.8% accurate, 6.5× speedup?

\[\frac{2}{\left(\pi \cdot z0\right) \cdot 2} \]
(FPCore (z1 z0)
  :precision binary64
  (/ 2.0 (* (* PI z0) 2.0)))
double code(double z1, double z0) {
	return 2.0 / ((((double) M_PI) * z0) * 2.0);
}
public static double code(double z1, double z0) {
	return 2.0 / ((Math.PI * z0) * 2.0);
}
def code(z1, z0):
	return 2.0 / ((math.pi * z0) * 2.0)
function code(z1, z0)
	return Float64(2.0 / Float64(Float64(pi * z0) * 2.0))
end
function tmp = code(z1, z0)
	tmp = 2.0 / ((pi * z0) * 2.0);
end
code[z1_, z0_] := N[(2.0 / N[(N[(Pi * z0), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\frac{2}{\left(\pi \cdot z0\right) \cdot 2}
Derivation
  1. Initial program 42.7%

    \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  2. Taylor expanded in z1 around 0

    \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
  3. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
    3. lower-PI.f6451.7%

      \[\leadsto \frac{1}{z0 \cdot \pi} \]
  4. Applied rewrites51.7%

    \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
  5. Step-by-step derivation
    1. *-lft-identityN/A

      \[\leadsto 1 \cdot \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \color{blue}{1} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot 1 \]
    4. cosh-0-revN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \cosh 0 \]
    5. cosh-defN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\color{blue}{2}} \]
    6. metadata-evalN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{2 \cdot \color{blue}{1}} \]
    7. cosh-0-revN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{2 \cdot \cosh 0} \]
    8. cosh-undef-revN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{e^{0} + \color{blue}{e^{\mathsf{neg}\left(0\right)}}} \]
    9. frac-timesN/A

      \[\leadsto \frac{1 \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}{\color{blue}{\left(z0 \cdot \pi\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}} \]
    10. cosh-undef-revN/A

      \[\leadsto \frac{1 \cdot \left(2 \cdot \cosh 0\right)}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    11. cosh-0-revN/A

      \[\leadsto \frac{1 \cdot \left(2 \cdot 1\right)}{\left(z0 \cdot \pi\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    12. metadata-evalN/A

      \[\leadsto \frac{1 \cdot 2}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    13. metadata-evalN/A

      \[\leadsto \frac{2}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    14. metadata-evalN/A

      \[\leadsto \frac{2 \cdot 1}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    15. cosh-0-revN/A

      \[\leadsto \frac{2 \cdot \cosh 0}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    16. cosh-undef-revN/A

      \[\leadsto \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    17. lower-/.f64N/A

      \[\leadsto \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\color{blue}{\left(z0 \cdot \pi\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}} \]
    18. cosh-undef-revN/A

      \[\leadsto \frac{2 \cdot \cosh 0}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    19. cosh-0-revN/A

      \[\leadsto \frac{2 \cdot 1}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    20. metadata-evalN/A

      \[\leadsto \frac{2}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    21. lower-*.f64N/A

      \[\leadsto \frac{2}{\left(z0 \cdot \pi\right) \cdot \color{blue}{\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}} \]
  6. Applied rewrites51.8%

    \[\leadsto \frac{2}{\color{blue}{\left(\pi \cdot z0\right) \cdot 2}} \]
  7. Add Preprocessing

Alternative 10: 51.7% accurate, 8.4× speedup?

\[\frac{1}{z0 \cdot \pi} \]
(FPCore (z1 z0)
  :precision binary64
  (/ 1.0 (* z0 PI)))
double code(double z1, double z0) {
	return 1.0 / (z0 * ((double) M_PI));
}
public static double code(double z1, double z0) {
	return 1.0 / (z0 * Math.PI);
}
def code(z1, z0):
	return 1.0 / (z0 * math.pi)
function code(z1, z0)
	return Float64(1.0 / Float64(z0 * pi))
end
function tmp = code(z1, z0)
	tmp = 1.0 / (z0 * pi);
end
code[z1_, z0_] := N[(1.0 / N[(z0 * Pi), $MachinePrecision]), $MachinePrecision]
\frac{1}{z0 \cdot \pi}
Derivation
  1. Initial program 42.7%

    \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  2. Taylor expanded in z1 around 0

    \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
  3. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
    3. lower-PI.f6451.7%

      \[\leadsto \frac{1}{z0 \cdot \pi} \]
  4. Applied rewrites51.7%

    \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
  5. Add Preprocessing

Alternative 11: 51.6% accurate, 11.8× speedup?

\[\frac{0.3183098861837907}{z0} \]
(FPCore (z1 z0)
  :precision binary64
  (/ 0.3183098861837907 z0))
double code(double z1, double z0) {
	return 0.3183098861837907 / z0;
}
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(z1, z0)
use fmin_fmax_functions
    real(8), intent (in) :: z1
    real(8), intent (in) :: z0
    code = 0.3183098861837907d0 / z0
end function
public static double code(double z1, double z0) {
	return 0.3183098861837907 / z0;
}
def code(z1, z0):
	return 0.3183098861837907 / z0
function code(z1, z0)
	return Float64(0.3183098861837907 / z0)
end
function tmp = code(z1, z0)
	tmp = 0.3183098861837907 / z0;
end
code[z1_, z0_] := N[(0.3183098861837907 / z0), $MachinePrecision]
\frac{0.3183098861837907}{z0}
Derivation
  1. Initial program 42.7%

    \[\frac{\sin \left(\left(z1 \cdot \pi\right) \cdot z0\right)}{\left(\left(\left(z1 \cdot \pi\right) \cdot z0\right) \cdot z0\right) \cdot \pi} \]
  2. Taylor expanded in z1 around 0

    \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
  3. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{\color{blue}{z0 \cdot \mathsf{PI}\left(\right)}} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{1}{z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}} \]
    3. lower-PI.f6451.7%

      \[\leadsto \frac{1}{z0 \cdot \pi} \]
  4. Applied rewrites51.7%

    \[\leadsto \color{blue}{\frac{1}{z0 \cdot \pi}} \]
  5. Step-by-step derivation
    1. *-lft-identityN/A

      \[\leadsto 1 \cdot \color{blue}{\frac{1}{z0 \cdot \pi}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \color{blue}{1} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot 1 \]
    4. cosh-0-revN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \cosh 0 \]
    5. cosh-defN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\color{blue}{2}} \]
    6. metadata-evalN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{2 \cdot \color{blue}{1}} \]
    7. cosh-0-revN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{2 \cdot \cosh 0} \]
    8. cosh-undef-revN/A

      \[\leadsto \frac{1}{z0 \cdot \pi} \cdot \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{e^{0} + \color{blue}{e^{\mathsf{neg}\left(0\right)}}} \]
    9. frac-timesN/A

      \[\leadsto \frac{1 \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}{\color{blue}{\left(z0 \cdot \pi\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}} \]
    10. cosh-undef-revN/A

      \[\leadsto \frac{1 \cdot \left(2 \cdot \cosh 0\right)}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    11. cosh-0-revN/A

      \[\leadsto \frac{1 \cdot \left(2 \cdot 1\right)}{\left(z0 \cdot \pi\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    12. metadata-evalN/A

      \[\leadsto \frac{1 \cdot 2}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    13. metadata-evalN/A

      \[\leadsto \frac{2}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    14. metadata-evalN/A

      \[\leadsto \frac{2 \cdot 1}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    15. cosh-0-revN/A

      \[\leadsto \frac{2 \cdot \cosh 0}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    16. cosh-undef-revN/A

      \[\leadsto \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    17. lower-/.f64N/A

      \[\leadsto \frac{e^{0} + e^{\mathsf{neg}\left(0\right)}}{\color{blue}{\left(z0 \cdot \pi\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}} \]
    18. cosh-undef-revN/A

      \[\leadsto \frac{2 \cdot \cosh 0}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    19. cosh-0-revN/A

      \[\leadsto \frac{2 \cdot 1}{\left(z0 \cdot \color{blue}{\pi}\right) \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    20. metadata-evalN/A

      \[\leadsto \frac{2}{\color{blue}{\left(z0 \cdot \pi\right)} \cdot \left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)} \]
    21. lower-*.f64N/A

      \[\leadsto \frac{2}{\left(z0 \cdot \pi\right) \cdot \color{blue}{\left(e^{0} + e^{\mathsf{neg}\left(0\right)}\right)}} \]
  6. Applied rewrites51.8%

    \[\leadsto \frac{2}{\color{blue}{\left(\pi \cdot z0\right) \cdot 2}} \]
  7. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{2}{\color{blue}{\left(\pi \cdot z0\right) \cdot 2}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{2}{\left(\pi \cdot z0\right) \cdot \color{blue}{2}} \]
    3. *-commutativeN/A

      \[\leadsto \frac{2}{2 \cdot \color{blue}{\left(\pi \cdot z0\right)}} \]
    4. associate-/r*N/A

      \[\leadsto \frac{\frac{2}{2}}{\color{blue}{\pi \cdot z0}} \]
    5. metadata-evalN/A

      \[\leadsto \frac{1}{\color{blue}{\pi} \cdot z0} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{1}{\pi \cdot \color{blue}{z0}} \]
    7. associate-/r*N/A

      \[\leadsto \frac{\frac{1}{\pi}}{\color{blue}{z0}} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{\frac{1}{\pi}}{\color{blue}{z0}} \]
    9. lower-/.f6451.6%

      \[\leadsto \frac{\frac{1}{\pi}}{z0} \]
  8. Applied rewrites51.6%

    \[\leadsto \frac{\frac{1}{\pi}}{\color{blue}{z0}} \]
  9. Evaluated real constant51.6%

    \[\leadsto \frac{0.3183098861837907}{z0} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2025250 
(FPCore (z1 z0)
  :name "(/ (sin (* (* z1 PI) z0)) (* (* (* (* z1 PI) z0) z0) PI))"
  :precision binary64
  (/ (sin (* (* z1 PI) z0)) (* (* (* (* z1 PI) z0) z0) PI)))