Average Error: 25.3 → 1.0
Time: 2.7s
Precision: 64
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.47255401943854624 \cdot 10^{-220}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]
x \cdot \sqrt{y \cdot y - z \cdot z}
\begin{array}{l}
\mathbf{if}\;y \le -3.47255401943854624 \cdot 10^{-220}:\\
\;\;\;\;x \cdot \left(-1 \cdot y\right)\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (x * ((double) sqrt(((double) (((double) (y * y)) - ((double) (z * z))))))));
}
double code(double x, double y, double z) {
	double VAR;
	if ((y <= -3.4725540194385462e-220)) {
		VAR = ((double) (x * ((double) (-1.0 * y))));
	} else {
		VAR = ((double) (x * y));
	}
	return VAR;
}

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

Original25.3
Target0.5
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;y \lt 2.58160964882516951 \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.4725540194385462e-220

    1. Initial program 25.3

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

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

    if -3.4725540194385462e-220 < y

    1. Initial program 25.3

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

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

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

Reproduce

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

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

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