Average Error: 23.7 → 0.4
Time: 19.6s
Precision: 64
Internal precision: 128
\[x \cdot \sqrt{y \cdot y - z \cdot z}\]
\[x \cdot \left(\sqrt{\left|y\right| + z} \cdot \sqrt{\left|y\right| - z}\right)\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original23.7
Comparison0.6
Herbie0.4
\[ \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. Initial program 23.7

    \[x \cdot \sqrt{y \cdot y - z \cdot z}\]
  2. Using strategy rm
  3. Applied square-unmult 23.7

    \[\leadsto x \cdot \sqrt{y \cdot y - \color{blue}{{z}^2}}\]
  4. Applied add-sqr-sqrt 23.7

    \[\leadsto x \cdot \sqrt{\color{blue}{{\left(\sqrt{y \cdot y}\right)}^2} - {z}^2}\]
  5. Applied difference-of-squares 23.7

    \[\leadsto x \cdot \sqrt{\color{blue}{\left(\sqrt{y \cdot y} + z\right) \cdot \left(\sqrt{y \cdot y} - z\right)}}\]
  6. Applied sqrt-prod 25.6

    \[\leadsto x \cdot \color{blue}{\left(\sqrt{\sqrt{y \cdot y} + z} \cdot \sqrt{\sqrt{y \cdot y} - z}\right)}\]
  7. Applied simplify 24.7

    \[\leadsto x \cdot \left(\color{blue}{\sqrt{\left|y\right| + z}} \cdot \sqrt{\sqrt{y \cdot y} - z}\right)\]
  8. Applied simplify 0.4

    \[\leadsto x \cdot \left(\sqrt{\left|y\right| + z} \cdot \color{blue}{\sqrt{\left|y\right| - z}}\right)\]
  9. Removed slow pow expressions

Runtime

Time bar (total: 19.6s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1691168047 4242681426 3874020424 3182956426 2642019976 2665983779)'
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, B"

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

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