Average Error: 26.8 → 0.1
Time: 1.0m
Precision: 64
Internal Precision: 384
\[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}\]
\[\left(0.5 \cdot \frac{x}{\frac{y}{x}} + 0.5 \cdot y\right) - 0.5 \cdot \frac{z}{\frac{y}{z}}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original26.8
Target0.2
Herbie0.1
\[y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)\]

Derivation

  1. Initial program 26.8

    \[\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2.0}\]
  2. Taylor expanded around 0 12.1

    \[\leadsto \color{blue}{\left(0.5 \cdot \frac{{x}^{2}}{y} + 0.5 \cdot y\right) - 0.5 \cdot \frac{{z}^{2}}{y}}\]
  3. Using strategy rm
  4. Applied unpow212.1

    \[\leadsto \left(0.5 \cdot \frac{\color{blue}{x \cdot x}}{y} + 0.5 \cdot y\right) - 0.5 \cdot \frac{{z}^{2}}{y}\]
  5. Applied associate-/l*6.7

    \[\leadsto \left(0.5 \cdot \color{blue}{\frac{x}{\frac{y}{x}}} + 0.5 \cdot y\right) - 0.5 \cdot \frac{{z}^{2}}{y}\]
  6. Using strategy rm
  7. Applied unpow26.7

    \[\leadsto \left(0.5 \cdot \frac{x}{\frac{y}{x}} + 0.5 \cdot y\right) - 0.5 \cdot \frac{\color{blue}{z \cdot z}}{y}\]
  8. Applied associate-/l*0.1

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

Runtime

Time bar (total: 1.0m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z)
  :name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"

  :herbie-target
  (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))

  (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))