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

Percentage Accurate: 53.6% → 98.9%
Time: 1.7s
Alternatives: 4
Speedup: 0.9×

Specification

?
\[\frac{\sin \left(\pi \cdot z0\right)}{\pi \cdot z0} \]
(FPCore (z0)
  :precision binary64
  (/ (sin (* PI z0)) (* PI z0)))
double code(double z0) {
	return sin((((double) M_PI) * z0)) / (((double) M_PI) * z0);
}
public static double code(double z0) {
	return Math.sin((Math.PI * z0)) / (Math.PI * z0);
}
def code(z0):
	return math.sin((math.pi * z0)) / (math.pi * z0)
function code(z0)
	return Float64(sin(Float64(pi * z0)) / Float64(pi * z0))
end
function tmp = code(z0)
	tmp = sin((pi * z0)) / (pi * z0);
end
code[z0_] := N[(N[Sin[N[(Pi * z0), $MachinePrecision]], $MachinePrecision] / N[(Pi * z0), $MachinePrecision]), $MachinePrecision]
\frac{\sin \left(\pi \cdot z0\right)}{\pi \cdot z0}

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 4 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: 53.6% accurate, 1.0× speedup?

\[\frac{\sin \left(\pi \cdot z0\right)}{\pi \cdot z0} \]
(FPCore (z0)
  :precision binary64
  (/ (sin (* PI z0)) (* PI z0)))
double code(double z0) {
	return sin((((double) M_PI) * z0)) / (((double) M_PI) * z0);
}
public static double code(double z0) {
	return Math.sin((Math.PI * z0)) / (Math.PI * z0);
}
def code(z0):
	return math.sin((math.pi * z0)) / (math.pi * z0)
function code(z0)
	return Float64(sin(Float64(pi * z0)) / Float64(pi * z0))
end
function tmp = code(z0)
	tmp = sin((pi * z0)) / (pi * z0);
end
code[z0_] := N[(N[Sin[N[(Pi * z0), $MachinePrecision]], $MachinePrecision] / N[(Pi * z0), $MachinePrecision]), $MachinePrecision]
\frac{\sin \left(\pi \cdot z0\right)}{\pi \cdot z0}

Alternative 1: 98.9% accurate, 0.9× speedup?

\[\begin{array}{l} t_0 := \pi \cdot \left|z0\right|\\ \mathbf{if}\;\left|z0\right| \leq 31000000000000:\\ \;\;\;\;\frac{\sin t\_0}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \left(\left(1.5707963267948966 - \pi\right) + 1.5707963267948966\right)}{t\_0}\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (let* ((t_0 (* PI (fabs z0))))
  (if (<= (fabs z0) 31000000000000.0)
    (/ (sin t_0) t_0)
    (/ (sin (+ (- 1.5707963267948966 PI) 1.5707963267948966)) t_0))))
double code(double z0) {
	double t_0 = ((double) M_PI) * fabs(z0);
	double tmp;
	if (fabs(z0) <= 31000000000000.0) {
		tmp = sin(t_0) / t_0;
	} else {
		tmp = sin(((1.5707963267948966 - ((double) M_PI)) + 1.5707963267948966)) / t_0;
	}
	return tmp;
}
public static double code(double z0) {
	double t_0 = Math.PI * Math.abs(z0);
	double tmp;
	if (Math.abs(z0) <= 31000000000000.0) {
		tmp = Math.sin(t_0) / t_0;
	} else {
		tmp = Math.sin(((1.5707963267948966 - Math.PI) + 1.5707963267948966)) / t_0;
	}
	return tmp;
}
def code(z0):
	t_0 = math.pi * math.fabs(z0)
	tmp = 0
	if math.fabs(z0) <= 31000000000000.0:
		tmp = math.sin(t_0) / t_0
	else:
		tmp = math.sin(((1.5707963267948966 - math.pi) + 1.5707963267948966)) / t_0
	return tmp
function code(z0)
	t_0 = Float64(pi * abs(z0))
	tmp = 0.0
	if (abs(z0) <= 31000000000000.0)
		tmp = Float64(sin(t_0) / t_0);
	else
		tmp = Float64(sin(Float64(Float64(1.5707963267948966 - pi) + 1.5707963267948966)) / t_0);
	end
	return tmp
end
function tmp_2 = code(z0)
	t_0 = pi * abs(z0);
	tmp = 0.0;
	if (abs(z0) <= 31000000000000.0)
		tmp = sin(t_0) / t_0;
	else
		tmp = sin(((1.5707963267948966 - pi) + 1.5707963267948966)) / t_0;
	end
	tmp_2 = tmp;
end
code[z0_] := Block[{t$95$0 = N[(Pi * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z0], $MachinePrecision], 31000000000000.0], N[(N[Sin[t$95$0], $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Sin[N[(N[(1.5707963267948966 - Pi), $MachinePrecision] + 1.5707963267948966), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \pi \cdot \left|z0\right|\\
\mathbf{if}\;\left|z0\right| \leq 31000000000000:\\
\;\;\;\;\frac{\sin t\_0}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sin \left(\left(1.5707963267948966 - \pi\right) + 1.5707963267948966\right)}{t\_0}\\


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

    1. Initial program 53.6%

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

    if 3.1e13 < z0

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\cos \left(\left(\frac{\color{blue}{\pi}}{2} + \pi \cdot z0\right) + \pi\right)}{\pi \cdot z0} \]
      11. mult-flipN/A

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

        \[\leadsto \frac{\cos \left(\left(\color{blue}{\pi \cdot \frac{1}{2}} + \pi \cdot z0\right) + \pi\right)}{\pi \cdot z0} \]
      13. metadata-eval7.2%

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

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

        \[\leadsto \frac{\cos \left(\left(\pi \cdot \frac{1}{2} + \color{blue}{z0 \cdot \pi}\right) + \pi\right)}{\pi \cdot z0} \]
      16. lower-*.f647.2%

        \[\leadsto \frac{\cos \left(\left(\pi \cdot 0.5 + \color{blue}{z0 \cdot \pi}\right) + \pi\right)}{\pi \cdot z0} \]
    3. Applied rewrites7.2%

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

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

        \[\leadsto \frac{\cos \left(\frac{1}{2} \cdot \color{blue}{\mathsf{PI}\left(\right)} + \pi\right)}{\pi \cdot z0} \]
      2. lower-PI.f646.2%

        \[\leadsto \frac{\cos \left(0.5 \cdot \pi + \pi\right)}{\pi \cdot z0} \]
    6. Applied rewrites6.2%

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

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

        \[\leadsto \frac{\cos \color{blue}{\left(\frac{1}{2} \cdot \pi + \pi\right)}}{\pi \cdot z0} \]
      3. add-flipN/A

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

        \[\leadsto \frac{\cos \left(\frac{1}{2} \cdot \pi - \color{blue}{\left(-\pi\right)}\right)}{\pi \cdot z0} \]
      5. cos-diffN/A

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

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

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

        \[\leadsto \frac{\cos \left(\frac{1}{2} \cdot \pi\right) \cdot \cos \pi + \sin \left(\frac{1}{2} \cdot \pi\right) \cdot \sin \color{blue}{\left(\mathsf{neg}\left(\pi\right)\right)}}{\pi \cdot z0} \]
    8. Applied rewrites49.6%

      \[\leadsto \frac{\color{blue}{\sin \left(\left(0.5 \cdot \pi - \pi\right) + 0.5 \cdot \pi\right)}}{\pi \cdot z0} \]
    9. Evaluated real constant49.6%

      \[\leadsto \frac{\sin \left(\left(1.5707963267948966 - \pi\right) + 0.5 \cdot \pi\right)}{\pi \cdot z0} \]
    10. Evaluated real constant49.6%

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

Alternative 2: 53.6% accurate, 0.5× speedup?

\[\begin{array}{l} \mathbf{if}\;\frac{\sin \left(\pi \cdot z0\right)}{\pi \cdot z0} \leq 10^{-22}:\\ \;\;\;\;\frac{\sin \pi}{\pi \cdot z0}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
(FPCore (z0)
  :precision binary64
  (if (<= (/ (sin (* PI z0)) (* PI z0)) 1e-22)
  (/ (sin PI) (* PI z0))
  1.0))
double code(double z0) {
	double tmp;
	if ((sin((((double) M_PI) * z0)) / (((double) M_PI) * z0)) <= 1e-22) {
		tmp = sin(((double) M_PI)) / (((double) M_PI) * z0);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
public static double code(double z0) {
	double tmp;
	if ((Math.sin((Math.PI * z0)) / (Math.PI * z0)) <= 1e-22) {
		tmp = Math.sin(Math.PI) / (Math.PI * z0);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(z0):
	tmp = 0
	if (math.sin((math.pi * z0)) / (math.pi * z0)) <= 1e-22:
		tmp = math.sin(math.pi) / (math.pi * z0)
	else:
		tmp = 1.0
	return tmp
function code(z0)
	tmp = 0.0
	if (Float64(sin(Float64(pi * z0)) / Float64(pi * z0)) <= 1e-22)
		tmp = Float64(sin(pi) / Float64(pi * z0));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(z0)
	tmp = 0.0;
	if ((sin((pi * z0)) / (pi * z0)) <= 1e-22)
		tmp = sin(pi) / (pi * z0);
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[z0_] := If[LessEqual[N[(N[Sin[N[(Pi * z0), $MachinePrecision]], $MachinePrecision] / N[(Pi * z0), $MachinePrecision]), $MachinePrecision], 1e-22], N[(N[Sin[Pi], $MachinePrecision] / N[(Pi * z0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\mathbf{if}\;\frac{\sin \left(\pi \cdot z0\right)}{\pi \cdot z0} \leq 10^{-22}:\\
\;\;\;\;\frac{\sin \pi}{\pi \cdot z0}\\

\mathbf{else}:\\
\;\;\;\;1\\


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

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\cos \left(\left(\frac{\color{blue}{\pi}}{2} + \pi \cdot z0\right) + \pi\right)}{\pi \cdot z0} \]
      11. mult-flipN/A

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

        \[\leadsto \frac{\cos \left(\left(\color{blue}{\pi \cdot \frac{1}{2}} + \pi \cdot z0\right) + \pi\right)}{\pi \cdot z0} \]
      13. metadata-eval7.2%

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

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

        \[\leadsto \frac{\cos \left(\left(\pi \cdot \frac{1}{2} + \color{blue}{z0 \cdot \pi}\right) + \pi\right)}{\pi \cdot z0} \]
      16. lower-*.f647.2%

        \[\leadsto \frac{\cos \left(\left(\pi \cdot 0.5 + \color{blue}{z0 \cdot \pi}\right) + \pi\right)}{\pi \cdot z0} \]
    3. Applied rewrites7.2%

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

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

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

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\cos \color{blue}{\left(\pi \cdot \frac{1}{2} + z0 \cdot \pi\right)}\right)}{\pi \cdot z0} \]
      6. +-commutativeN/A

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

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

        \[\leadsto \frac{\mathsf{neg}\left(\cos \left(z0 \cdot \pi + \pi \cdot \color{blue}{\frac{1}{2}}\right)\right)}{\pi \cdot z0} \]
      9. mult-flipN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sin \color{blue}{\pi}}{\pi \cdot z0} \]
    7. Step-by-step derivation
      1. lower-PI.f646.2%

        \[\leadsto \frac{\sin \pi}{\pi \cdot z0} \]
    8. Applied rewrites6.2%

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

    if 1e-22 < (/.f64 (sin.f64 (*.f64 (PI.f64) z0)) (*.f64 (PI.f64) z0))

    1. Initial program 53.6%

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

      \[\leadsto \color{blue}{1} \]
    3. Step-by-step derivation
      1. Applied rewrites50.5%

        \[\leadsto \color{blue}{1} \]
    4. Recombined 2 regimes into one program.
    5. Add Preprocessing

    Alternative 3: 50.5% accurate, 122.0× speedup?

    \[1 \]
    (FPCore (z0)
      :precision binary64
      1.0)
    double code(double z0) {
    	return 1.0;
    }
    
    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(z0)
    use fmin_fmax_functions
        real(8), intent (in) :: z0
        code = 1.0d0
    end function
    
    public static double code(double z0) {
    	return 1.0;
    }
    
    def code(z0):
    	return 1.0
    
    function code(z0)
    	return 1.0
    end
    
    function tmp = code(z0)
    	tmp = 1.0;
    end
    
    code[z0_] := 1.0
    
    1
    
    Derivation
    1. Initial program 53.6%

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

      \[\leadsto \color{blue}{1} \]
    3. Step-by-step derivation
      1. Applied rewrites50.5%

        \[\leadsto \color{blue}{1} \]
      2. Add Preprocessing

      Reproduce

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