Average Error: 23.5 → 0.8
Time: 21.2s
Precision: 64
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.0360529674537215 \cdot 10^{-253}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]
x \cdot \sqrt{y \cdot y - z \cdot z}
\begin{array}{l}
\mathbf{if}\;y \le -3.0360529674537215 \cdot 10^{-253}:\\
\;\;\;\;\left(-x\right) \cdot y\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\

\end{array}
double f(double x, double y, double z) {
        double r31703978 = x;
        double r31703979 = y;
        double r31703980 = r31703979 * r31703979;
        double r31703981 = z;
        double r31703982 = r31703981 * r31703981;
        double r31703983 = r31703980 - r31703982;
        double r31703984 = sqrt(r31703983);
        double r31703985 = r31703978 * r31703984;
        return r31703985;
}

double f(double x, double y, double __attribute__((unused)) z) {
        double r31703986 = y;
        double r31703987 = -3.0360529674537215e-253;
        bool r31703988 = r31703986 <= r31703987;
        double r31703989 = x;
        double r31703990 = -r31703989;
        double r31703991 = r31703990 * r31703986;
        double r31703992 = r31703989 * r31703986;
        double r31703993 = r31703988 ? r31703991 : r31703992;
        return r31703993;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original23.5
Target0.5
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;y \lt 2.5816096488251695 \cdot 10^{-278}:\\ \;\;\;\;-x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\sqrt{y + z} \cdot \sqrt{y - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -3.0360529674537215e-253

    1. Initial program 23.3

      \[x \cdot \sqrt{y \cdot y - z \cdot z}\]
    2. Using strategy rm
    3. Applied difference-of-squares23.2

      \[\leadsto x \cdot \sqrt{\color{blue}{\left(y + z\right) \cdot \left(y - z\right)}}\]
    4. Taylor expanded around -inf 0.5

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot y\right)}\]
    5. Simplified0.5

      \[\leadsto x \cdot \color{blue}{\left(-y\right)}\]

    if -3.0360529674537215e-253 < y

    1. Initial program 23.7

      \[x \cdot \sqrt{y \cdot y - z \cdot z}\]
    2. Taylor expanded around inf 1.0

      \[\leadsto x \cdot \color{blue}{y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -3.0360529674537215 \cdot 10^{-253}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, B"

  :herbie-target
  (if (< y 2.5816096488251695e-278) (- (* x y)) (* x (* (sqrt (+ y z)) (sqrt (- y z)))))

  (* x (sqrt (- (* y y) (* z z)))))