Average Error: 32.6 → 0.5
Time: 45.3s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\left(\left|\frac{x}{y}\right| \cdot \sqrt{\left|\frac{x}{y}\right|}\right) \cdot \sqrt{\left|\frac{x}{y}\right|} + \left|\frac{z}{t}\right| \cdot \left|\frac{z}{t}\right|\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original32.6
Target0.4
Herbie0.5
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}\]

Derivation

  1. Initial program 32.6

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt32.6

    \[\leadsto \color{blue}{\sqrt{\frac{x \cdot x}{y \cdot y}} \cdot \sqrt{\frac{x \cdot x}{y \cdot y}}} + \frac{z \cdot z}{t \cdot t}\]
  4. Applied simplify32.6

    \[\leadsto \color{blue}{\left|\frac{x}{y}\right|} \cdot \sqrt{\frac{x \cdot x}{y \cdot y}} + \frac{z \cdot z}{t \cdot t}\]
  5. Applied simplify18.3

    \[\leadsto \left|\frac{x}{y}\right| \cdot \color{blue}{\left|\frac{x}{y}\right|} + \frac{z \cdot z}{t \cdot t}\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt18.4

    \[\leadsto \left|\frac{x}{y}\right| \cdot \left|\frac{x}{y}\right| + \color{blue}{\sqrt{\frac{z \cdot z}{t \cdot t}} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}}}\]
  8. Applied simplify18.4

    \[\leadsto \left|\frac{x}{y}\right| \cdot \left|\frac{x}{y}\right| + \color{blue}{\left|\frac{z}{t}\right|} \cdot \sqrt{\frac{z \cdot z}{t \cdot t}}\]
  9. Applied simplify0.4

    \[\leadsto \left|\frac{x}{y}\right| \cdot \left|\frac{x}{y}\right| + \left|\frac{z}{t}\right| \cdot \color{blue}{\left|\frac{z}{t}\right|}\]
  10. Using strategy rm
  11. Applied add-sqr-sqrt0.5

    \[\leadsto \left|\frac{x}{y}\right| \cdot \color{blue}{\left(\sqrt{\left|\frac{x}{y}\right|} \cdot \sqrt{\left|\frac{x}{y}\right|}\right)} + \left|\frac{z}{t}\right| \cdot \left|\frac{z}{t}\right|\]
  12. Applied associate-*r*0.5

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

Runtime

Time bar (total: 45.3s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"

  :herbie-target
  (+ (pow (/ x y) 2) (pow (/ z t) 2))

  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))