Average Error: 30.6 → 25.2
Time: 21.0s
Precision: 64
\[{\left(\sin \left(\sqrt{x + 1} - \sqrt{x}\right)\right)}^{2}\]
\[\begin{array}{l} \mathbf{if}\;x \le 12200168442213850:\\ \;\;\;\;{\left(\sin \left(\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sin \left({\left(e^{\sqrt{\log \left(\sqrt{x + 1}\right)}}\right)}^{\left(\sqrt{\log \left(\sqrt{x + 1}\right)}\right)} - \sqrt{x}\right)\right)}^{2}\\ \end{array}\]
{\left(\sin \left(\sqrt{x + 1} - \sqrt{x}\right)\right)}^{2}
\begin{array}{l}
\mathbf{if}\;x \le 12200168442213850:\\
\;\;\;\;{\left(\sin \left(\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}\right)\right)}^{2}\\

\mathbf{else}:\\
\;\;\;\;{\left(\sin \left({\left(e^{\sqrt{\log \left(\sqrt{x + 1}\right)}}\right)}^{\left(\sqrt{\log \left(\sqrt{x + 1}\right)}\right)} - \sqrt{x}\right)\right)}^{2}\\

\end{array}
double f(double x) {
        double r981665 = x;
        double r981666 = 1.0;
        double r981667 = r981665 + r981666;
        double r981668 = sqrt(r981667);
        double r981669 = sqrt(r981665);
        double r981670 = r981668 - r981669;
        double r981671 = sin(r981670);
        double r981672 = 2.0;
        double r981673 = pow(r981671, r981672);
        return r981673;
}

double f(double x) {
        double r981674 = x;
        double r981675 = 1.220016844221385e+16;
        bool r981676 = r981674 <= r981675;
        double r981677 = 1.0;
        double r981678 = r981674 + r981677;
        double r981679 = r981678 - r981674;
        double r981680 = sqrt(r981678);
        double r981681 = sqrt(r981674);
        double r981682 = r981680 + r981681;
        double r981683 = r981679 / r981682;
        double r981684 = sin(r981683);
        double r981685 = 2.0;
        double r981686 = pow(r981684, r981685);
        double r981687 = log(r981680);
        double r981688 = sqrt(r981687);
        double r981689 = exp(r981688);
        double r981690 = pow(r981689, r981688);
        double r981691 = r981690 - r981681;
        double r981692 = sin(r981691);
        double r981693 = pow(r981692, r981685);
        double r981694 = r981676 ? r981686 : r981693;
        return r981694;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 1.220016844221385e+16

    1. Initial program 1.5

      \[{\left(\sin \left(\sqrt{x + 1} - \sqrt{x}\right)\right)}^{2}\]
    2. Using strategy rm
    3. Applied flip--1.0

      \[\leadsto {\left(\sin \color{blue}{\left(\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}\right)}\right)}^{2}\]
    4. Simplified0.1

      \[\leadsto {\left(\sin \left(\frac{\color{blue}{\left(x + 1\right) - x}}{\sqrt{x + 1} + \sqrt{x}}\right)\right)}^{2}\]

    if 1.220016844221385e+16 < x

    1. Initial program 62.0

      \[{\left(\sin \left(\sqrt{x + 1} - \sqrt{x}\right)\right)}^{2}\]
    2. Using strategy rm
    3. Applied add-exp-log52.1

      \[\leadsto {\left(\sin \left(\color{blue}{e^{\log \left(\sqrt{x + 1}\right)}} - \sqrt{x}\right)\right)}^{2}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt52.1

      \[\leadsto {\left(\sin \left(e^{\color{blue}{\sqrt{\log \left(\sqrt{x + 1}\right)} \cdot \sqrt{\log \left(\sqrt{x + 1}\right)}}} - \sqrt{x}\right)\right)}^{2}\]
    6. Applied exp-prod52.1

      \[\leadsto {\left(\sin \left(\color{blue}{{\left(e^{\sqrt{\log \left(\sqrt{x + 1}\right)}}\right)}^{\left(\sqrt{\log \left(\sqrt{x + 1}\right)}\right)}} - \sqrt{x}\right)\right)}^{2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification25.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 12200168442213850:\\ \;\;\;\;{\left(\sin \left(\frac{\left(x + 1\right) - x}{\sqrt{x + 1} + \sqrt{x}}\right)\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sin \left({\left(e^{\sqrt{\log \left(\sqrt{x + 1}\right)}}\right)}^{\left(\sqrt{\log \left(\sqrt{x + 1}\right)}\right)} - \sqrt{x}\right)\right)}^{2}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sin(sqrt(x+1) - sqrt(x))^2"
  :precision binary64
  (pow (sin (- (sqrt (+ x 1)) (sqrt x))) 2))