Average Error: 16.6 → 10.0
Time: 13.4s
Precision: 64
\[\left|x\right| \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}\]
\[\begin{array}{l} \mathbf{if}\;\left|x\right| \cdot \sqrt{\frac{y}{x} \cdot \frac{y}{x} + 1} \le 2.4406682147969948 \cdot 10^{+305}:\\ \;\;\;\;\left|x\right| \cdot \sqrt{\frac{y}{x} \cdot \frac{y}{x} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left|x\right|}{x}\\ \end{array}\]
\left|x\right| \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}
\begin{array}{l}
\mathbf{if}\;\left|x\right| \cdot \sqrt{\frac{y}{x} \cdot \frac{y}{x} + 1} \le 2.4406682147969948 \cdot 10^{+305}:\\
\;\;\;\;\left|x\right| \cdot \sqrt{\frac{y}{x} \cdot \frac{y}{x} + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left|x\right|}{x}\\

\end{array}
double f(double x, double y) {
        double r43696190 = x;
        double r43696191 = fabs(r43696190);
        double r43696192 = 1.0;
        double r43696193 = y;
        double r43696194 = r43696193 / r43696190;
        double r43696195 = r43696194 * r43696194;
        double r43696196 = r43696192 + r43696195;
        double r43696197 = sqrt(r43696196);
        double r43696198 = r43696191 * r43696197;
        return r43696198;
}

double f(double x, double y) {
        double r43696199 = x;
        double r43696200 = fabs(r43696199);
        double r43696201 = y;
        double r43696202 = r43696201 / r43696199;
        double r43696203 = r43696202 * r43696202;
        double r43696204 = 1.0;
        double r43696205 = r43696203 + r43696204;
        double r43696206 = sqrt(r43696205);
        double r43696207 = r43696200 * r43696206;
        double r43696208 = 2.4406682147969948e+305;
        bool r43696209 = r43696207 <= r43696208;
        double r43696210 = r43696201 * r43696200;
        double r43696211 = r43696210 / r43696199;
        double r43696212 = r43696209 ? r43696207 : r43696211;
        return r43696212;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (* (fabs x) (sqrt (+ 1 (* (/ y x) (/ y x))))) < 2.4406682147969948e+305

    1. Initial program 0.0

      \[\left|x\right| \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}\]

    if 2.4406682147969948e+305 < (* (fabs x) (sqrt (+ 1 (* (/ y x) (/ y x)))))

    1. Initial program 59.0

      \[\left|x\right| \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}\]
    2. Taylor expanded around 0 35.6

      \[\leadsto \color{blue}{\frac{\left|x\right| \cdot y}{x}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left|x\right| \cdot \sqrt{\frac{y}{x} \cdot \frac{y}{x} + 1} \le 2.4406682147969948 \cdot 10^{+305}:\\ \;\;\;\;\left|x\right| \cdot \sqrt{\frac{y}{x} \cdot \frac{y}{x} + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left|x\right|}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x y)
  :name "abs(x) * sqrt(1 + (y/x)*(y/x))"
  (* (fabs x) (sqrt (+ 1 (* (/ y x) (/ y x))))))