(cos (* -1/90 (* z0 PI)))

Percentage Accurate: 56.9% → 57.0%
Time: 4.2s
Alternatives: 4
Speedup: 1.0×

Specification

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

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

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

Alternative 1: 57.0% accurate, 0.3× speedup?

\[\sin \left(\left(\left({\pi}^{\frac{2}{3}} \cdot \frac{1}{90}\right) \cdot \left|z0\right|\right) \cdot \sqrt[3]{\pi} - \pi \cdot \frac{-1}{2}\right) \]
(FPCore (z0)
  :precision binary64
  (sin
 (- (* (* (* (pow PI 2/3) 1/90) (fabs z0)) (cbrt PI)) (* PI -1/2))))
double code(double z0) {
	return sin(((((pow(((double) M_PI), 0.6666666666666666) * 0.011111111111111112) * fabs(z0)) * cbrt(((double) M_PI))) - (((double) M_PI) * -0.5)));
}
public static double code(double z0) {
	return Math.sin(((((Math.pow(Math.PI, 0.6666666666666666) * 0.011111111111111112) * Math.abs(z0)) * Math.cbrt(Math.PI)) - (Math.PI * -0.5)));
}
function code(z0)
	return sin(Float64(Float64(Float64(Float64((pi ^ 0.6666666666666666) * 0.011111111111111112) * abs(z0)) * cbrt(pi)) - Float64(pi * -0.5)))
end
code[z0_] := N[Sin[N[(N[(N[(N[(N[Power[Pi, 2/3], $MachinePrecision] * 1/90), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * N[Power[Pi, 1/3], $MachinePrecision]), $MachinePrecision] - N[(Pi * -1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(\left(\left({\pi}^{\frac{2}{3}} \cdot \frac{1}{90}\right) \cdot \left|z0\right|\right) \cdot \sqrt[3]{\pi} - \pi \cdot \frac{-1}{2}\right)
Derivation
  1. Initial program 56.9%

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

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

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

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

      \[\leadsto \color{blue}{\sin \left(\left(\mathsf{neg}\left(\frac{-1}{90} \cdot \left(z0 \cdot \pi\right)\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
    5. add-flipN/A

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

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

      \[\leadsto \sin \left(\left(\mathsf{neg}\left(\color{blue}{\frac{-1}{90} \cdot \left(z0 \cdot \pi\right)}\right)\right) - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    8. distribute-lft-neg-inN/A

      \[\leadsto \sin \left(\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{90}\right)\right) \cdot \left(z0 \cdot \pi\right)} - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \sin \left(\color{blue}{\frac{1}{90}} \cdot \left(z0 \cdot \pi\right) - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    10. metadata-evalN/A

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

      \[\leadsto \sin \left(\color{blue}{\left|\frac{-1}{90}\right| \cdot \left(z0 \cdot \pi\right)} - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    12. metadata-evalN/A

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

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

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

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \left(\mathsf{neg}\left(\color{blue}{\pi \cdot \frac{1}{2}}\right)\right)\right) \]
    18. distribute-rgt-neg-inN/A

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \color{blue}{\frac{-1}{2}}\right) \]
    21. metadata-evalN/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \color{blue}{\frac{1}{-2}}\right) \]
    22. metadata-evalN/A

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \frac{1}{\color{blue}{-2}}\right) \]
    25. metadata-eval57.0%

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \color{blue}{\frac{-1}{2}}\right) \]
  3. Applied rewrites57.0%

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

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

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(z0 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) - \pi \cdot \frac{-1}{2}\right) \]
    5. add-cube-cbrtN/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(z0 \cdot \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)}\right) - \pi \cdot \frac{-1}{2}\right) \]
    6. lift-PI.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(z0 \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\color{blue}{\pi}}\right)\right) - \pi \cdot \frac{-1}{2}\right) \]
    7. lift-cbrt.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(z0 \cdot \left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \color{blue}{\sqrt[3]{\pi}}\right)\right) - \pi \cdot \frac{-1}{2}\right) \]
    8. associate-*l*N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \color{blue}{\left(\left(z0 \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt[3]{\pi}\right)} - \pi \cdot \frac{-1}{2}\right) \]
    9. lift-PI.f64N/A

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\left(z0 \cdot \left(\color{blue}{{\pi}^{\frac{1}{3}}} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    11. lift-PI.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\left(z0 \cdot \left({\pi}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{\pi}}\right)\right) \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    12. pow1/3N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\left(z0 \cdot \left({\pi}^{\frac{1}{3}} \cdot \color{blue}{{\pi}^{\frac{1}{3}}}\right)\right) \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    13. pow-prod-upN/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\left(z0 \cdot \color{blue}{{\pi}^{\left(\frac{1}{3} + \frac{1}{3}\right)}}\right) \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    14. metadata-evalN/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\left(z0 \cdot {\pi}^{\color{blue}{\frac{2}{3}}}\right) \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    15. lift-pow.f64N/A

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\color{blue}{\left({\pi}^{\frac{2}{3}} \cdot z0\right)} \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    17. lift-*.f64N/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\color{blue}{\left({\pi}^{\frac{2}{3}} \cdot z0\right)} \cdot \sqrt[3]{\pi}\right) - \pi \cdot \frac{-1}{2}\right) \]
    18. associate-*r*N/A

      \[\leadsto \sin \left(\color{blue}{\left(\frac{1}{90} \cdot \left({\pi}^{\frac{2}{3}} \cdot z0\right)\right) \cdot \sqrt[3]{\pi}} - \pi \cdot \frac{-1}{2}\right) \]
  5. Applied rewrites57.0%

    \[\leadsto \sin \left(\color{blue}{\left(\left({\pi}^{\frac{2}{3}} \cdot \frac{1}{90}\right) \cdot z0\right) \cdot \sqrt[3]{\pi}} - \pi \cdot \frac{-1}{2}\right) \]
  6. Add Preprocessing

Alternative 2: 56.9% accurate, 1.0× speedup?

\[\sin \left(\pi \cdot \left(\frac{1}{90} \cdot \left|z0\right| - \frac{-1}{2}\right)\right) \]
(FPCore (z0)
  :precision binary64
  (sin (* PI (- (* 1/90 (fabs z0)) -1/2))))
double code(double z0) {
	return sin((((double) M_PI) * ((0.011111111111111112 * fabs(z0)) - -0.5)));
}
public static double code(double z0) {
	return Math.sin((Math.PI * ((0.011111111111111112 * Math.abs(z0)) - -0.5)));
}
def code(z0):
	return math.sin((math.pi * ((0.011111111111111112 * math.fabs(z0)) - -0.5)))
function code(z0)
	return sin(Float64(pi * Float64(Float64(0.011111111111111112 * abs(z0)) - -0.5)))
end
function tmp = code(z0)
	tmp = sin((pi * ((0.011111111111111112 * abs(z0)) - -0.5)));
end
code[z0_] := N[Sin[N[(Pi * N[(N[(1/90 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] - -1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sin \left(\pi \cdot \left(\frac{1}{90} \cdot \left|z0\right| - \frac{-1}{2}\right)\right)
Derivation
  1. Initial program 56.9%

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

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

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

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

      \[\leadsto \color{blue}{\sin \left(\left(\mathsf{neg}\left(\frac{-1}{90} \cdot \left(z0 \cdot \pi\right)\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
    5. add-flipN/A

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

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

      \[\leadsto \sin \left(\left(\mathsf{neg}\left(\color{blue}{\frac{-1}{90} \cdot \left(z0 \cdot \pi\right)}\right)\right) - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    8. distribute-lft-neg-inN/A

      \[\leadsto \sin \left(\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{90}\right)\right) \cdot \left(z0 \cdot \pi\right)} - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \sin \left(\color{blue}{\frac{1}{90}} \cdot \left(z0 \cdot \pi\right) - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    10. metadata-evalN/A

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

      \[\leadsto \sin \left(\color{blue}{\left|\frac{-1}{90}\right| \cdot \left(z0 \cdot \pi\right)} - \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
    12. metadata-evalN/A

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

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

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

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \left(\mathsf{neg}\left(\color{blue}{\pi \cdot \frac{1}{2}}\right)\right)\right) \]
    18. distribute-rgt-neg-inN/A

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \color{blue}{\frac{-1}{2}}\right) \]
    21. metadata-evalN/A

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \color{blue}{\frac{1}{-2}}\right) \]
    22. metadata-evalN/A

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

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

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \frac{1}{\color{blue}{-2}}\right) \]
    25. metadata-eval57.0%

      \[\leadsto \sin \left(\frac{1}{90} \cdot \left(\pi \cdot z0\right) - \pi \cdot \color{blue}{\frac{-1}{2}}\right) \]
  3. Applied rewrites57.0%

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

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

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

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

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

      \[\leadsto \sin \left(\color{blue}{\left(\frac{1}{90} \cdot z0\right) \cdot \pi} - \pi \cdot \frac{-1}{2}\right) \]
    6. metadata-evalN/A

      \[\leadsto \sin \left(\left(\color{blue}{\left(\mathsf{neg}\left(\frac{-1}{90}\right)\right)} \cdot z0\right) \cdot \pi - \pi \cdot \frac{-1}{2}\right) \]
    7. distribute-lft-neg-outN/A

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

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

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

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

      \[\leadsto \sin \left(\left(\mathsf{neg}\left(z0 \cdot \frac{-1}{90}\right)\right) \cdot \pi - \color{blue}{\frac{-1}{2} \cdot \pi}\right) \]
    12. distribute-rgt-out--N/A

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

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

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

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

      \[\leadsto \sin \left(\pi \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{-1}{90} \cdot z0}\right)\right) - \frac{-1}{2}\right)\right) \]
    17. distribute-lft-neg-outN/A

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

      \[\leadsto \sin \left(\pi \cdot \left(\color{blue}{\frac{1}{90}} \cdot z0 - \frac{-1}{2}\right)\right) \]
    19. lower-*.f6457.1%

      \[\leadsto \sin \left(\pi \cdot \left(\color{blue}{\frac{1}{90} \cdot z0} - \frac{-1}{2}\right)\right) \]
  5. Applied rewrites57.1%

    \[\leadsto \sin \color{blue}{\left(\pi \cdot \left(\frac{1}{90} \cdot z0 - \frac{-1}{2}\right)\right)} \]
  6. Add Preprocessing

Alternative 3: 56.9% accurate, 1.0× speedup?

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

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

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

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

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

      \[\leadsto \cos \left(\left(\frac{-1}{90} \cdot z0\right) \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \]
    5. add-cube-cbrtN/A

      \[\leadsto \cos \left(\left(\frac{-1}{90} \cdot z0\right) \cdot \color{blue}{\left(\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)}\right) \]
    6. associate-*r*N/A

      \[\leadsto \cos \color{blue}{\left(\left(\left(\frac{-1}{90} \cdot z0\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)} \]
    7. add-cube-cbrtN/A

      \[\leadsto \cos \left(\left(\left(\frac{-1}{90} \cdot z0\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}}}\right) \]
    8. cbrt-prodN/A

      \[\leadsto \cos \left(\left(\left(\frac{-1}{90} \cdot z0\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \color{blue}{\left(\sqrt[3]{\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}} \cdot \sqrt[3]{\sqrt[3]{\mathsf{PI}\left(\right)}}\right)}\right) \]
    9. associate-*r*N/A

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

      \[\leadsto \cos \color{blue}{\left(\left(\left(\left(\frac{-1}{90} \cdot z0\right) \cdot \left(\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right)\right) \cdot \sqrt[3]{\sqrt[3]{\mathsf{PI}\left(\right)} \cdot \sqrt[3]{\mathsf{PI}\left(\right)}}\right) \cdot \sqrt[3]{\sqrt[3]{\mathsf{PI}\left(\right)}}\right)} \]
  3. Applied rewrites56.8%

    \[\leadsto \cos \color{blue}{\left(\left(\left(\frac{-1}{90} \cdot \left({\pi}^{\frac{2}{3}} \cdot z0\right)\right) \cdot {\pi}^{\frac{2}{9}}\right) \cdot {\pi}^{\frac{1}{9}}\right)} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

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

      \[\leadsto \cos \left(\color{blue}{\left(\left(\frac{-1}{90} \cdot \left({\pi}^{\frac{2}{3}} \cdot z0\right)\right) \cdot {\pi}^{\frac{2}{9}}\right)} \cdot {\pi}^{\frac{1}{9}}\right) \]
    3. associate-*l*N/A

      \[\leadsto \cos \color{blue}{\left(\left(\frac{-1}{90} \cdot \left({\pi}^{\frac{2}{3}} \cdot z0\right)\right) \cdot \left({\pi}^{\frac{2}{9}} \cdot {\pi}^{\frac{1}{9}}\right)\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \cos \left(\color{blue}{\left(\frac{-1}{90} \cdot \left({\pi}^{\frac{2}{3}} \cdot z0\right)\right)} \cdot \left({\pi}^{\frac{2}{9}} \cdot {\pi}^{\frac{1}{9}}\right)\right) \]
    5. lift-*.f64N/A

      \[\leadsto \cos \left(\left(\frac{-1}{90} \cdot \color{blue}{\left({\pi}^{\frac{2}{3}} \cdot z0\right)}\right) \cdot \left({\pi}^{\frac{2}{9}} \cdot {\pi}^{\frac{1}{9}}\right)\right) \]
    6. associate-*r*N/A

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

      \[\leadsto \cos \left(\color{blue}{\left(z0 \cdot \left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right)\right)} \cdot \left({\pi}^{\frac{2}{9}} \cdot {\pi}^{\frac{1}{9}}\right)\right) \]
    8. lift-pow.f64N/A

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

      \[\leadsto \cos \left(\left(z0 \cdot \left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right)\right) \cdot \left({\pi}^{\frac{2}{9}} \cdot \color{blue}{{\pi}^{\frac{1}{9}}}\right)\right) \]
    10. pow-prod-upN/A

      \[\leadsto \cos \left(\left(z0 \cdot \left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right)\right) \cdot \color{blue}{{\pi}^{\left(\frac{2}{9} + \frac{1}{9}\right)}}\right) \]
    11. metadata-evalN/A

      \[\leadsto \cos \left(\left(z0 \cdot \left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right)\right) \cdot {\pi}^{\color{blue}{\frac{1}{3}}}\right) \]
    12. pow1/3N/A

      \[\leadsto \cos \left(\left(z0 \cdot \left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right)\right) \cdot \color{blue}{\sqrt[3]{\pi}}\right) \]
    13. lift-cbrt.f64N/A

      \[\leadsto \cos \left(\left(z0 \cdot \left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right)\right) \cdot \color{blue}{\sqrt[3]{\pi}}\right) \]
    14. associate-*l*N/A

      \[\leadsto \cos \color{blue}{\left(z0 \cdot \left(\left(\frac{-1}{90} \cdot {\pi}^{\frac{2}{3}}\right) \cdot \sqrt[3]{\pi}\right)\right)} \]
  5. Applied rewrites56.9%

    \[\leadsto \cos \color{blue}{\left(\left(\pi \cdot \frac{-1}{90}\right) \cdot z0\right)} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2025277 -o generate:taylor -o generate:evaluate
(FPCore (z0)
  :name "(cos (* -1/90 (* z0 PI)))"
  :precision binary64
  (cos (* -1/90 (* z0 PI))))