Average Error: 25.5 → 0.4
Time: 11.2s
Precision: 64
\[\mathsf{min}\left(\sin \left(x + 1\right), \cos \left(x - 1\right)\right)\]
\[\mathsf{min}\left(\cos 1 \cdot \sin x + \cos x \cdot \sin 1, \cos x \cdot \cos 1 - \sin x \cdot \sin \left(-1\right)\right)\]
\mathsf{min}\left(\sin \left(x + 1\right), \cos \left(x - 1\right)\right)
\mathsf{min}\left(\cos 1 \cdot \sin x + \cos x \cdot \sin 1, \cos x \cdot \cos 1 - \sin x \cdot \sin \left(-1\right)\right)
double f(double x) {
        double r1205754 = x;
        double r1205755 = 1.0;
        double r1205756 = r1205754 + r1205755;
        double r1205757 = sin(r1205756);
        double r1205758 = r1205754 - r1205755;
        double r1205759 = cos(r1205758);
        double r1205760 = fmin(r1205757, r1205759);
        return r1205760;
}

double f(double x) {
        double r1205761 = 1.0;
        double r1205762 = cos(r1205761);
        double r1205763 = x;
        double r1205764 = sin(r1205763);
        double r1205765 = r1205762 * r1205764;
        double r1205766 = cos(r1205763);
        double r1205767 = sin(r1205761);
        double r1205768 = r1205766 * r1205767;
        double r1205769 = r1205765 + r1205768;
        double r1205770 = r1205766 * r1205762;
        double r1205771 = -r1205761;
        double r1205772 = sin(r1205771);
        double r1205773 = r1205764 * r1205772;
        double r1205774 = r1205770 - r1205773;
        double r1205775 = fmin(r1205769, r1205774);
        return r1205775;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 25.5

    \[\mathsf{min}\left(\sin \left(x + 1\right), \cos \left(x - 1\right)\right)\]
  2. Using strategy rm
  3. Applied sub-neg25.5

    \[\leadsto \mathsf{min}\left(\sin \left(x + 1\right), \cos \color{blue}{\left(x + \left(-1\right)\right)}\right)\]
  4. Applied cos-sum23.6

    \[\leadsto \mathsf{min}\left(\sin \left(x + 1\right), \color{blue}{\cos x \cdot \cos \left(-1\right) - \sin x \cdot \sin \left(-1\right)}\right)\]
  5. Simplified23.6

    \[\leadsto \mathsf{min}\left(\sin \left(x + 1\right), \color{blue}{\cos x \cdot \cos 1} - \sin x \cdot \sin \left(-1\right)\right)\]
  6. Using strategy rm
  7. Applied sin-sum0.4

    \[\leadsto \mathsf{min}\left(\color{blue}{\sin x \cdot \cos 1 + \cos x \cdot \sin 1}, \cos x \cdot \cos 1 - \sin x \cdot \sin \left(-1\right)\right)\]
  8. Simplified0.4

    \[\leadsto \mathsf{min}\left(\color{blue}{\cos 1 \cdot \sin x} + \cos x \cdot \sin 1, \cos x \cdot \cos 1 - \sin x \cdot \sin \left(-1\right)\right)\]
  9. Final simplification0.4

    \[\leadsto \mathsf{min}\left(\cos 1 \cdot \sin x + \cos x \cdot \sin 1, \cos x \cdot \cos 1 - \sin x \cdot \sin \left(-1\right)\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "min(sin(x+1), cos(x-1))"
  :precision binary64
  (fmin (sin (+ x 1)) (cos (- x 1))))