Average Error: 5.9 → 0.1
Time: 3.9s
Precision: 64
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
\[x \cdot x - \left(\left(\left(y \cdot 4\right) \cdot z\right) \cdot z + \left(y \cdot 4\right) \cdot \left(-t\right)\right)\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original5.9
Target5.9
Herbie0.1
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Derivation

  1. Initial program 5.9

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
  2. Using strategy rm
  3. Applied sub-neg5.9

    \[\leadsto x \cdot x - \left(y \cdot 4\right) \cdot \color{blue}{\left(z \cdot z + \left(-t\right)\right)}\]
  4. Applied distribute-lft-in5.9

    \[\leadsto x \cdot x - \color{blue}{\left(\left(y \cdot 4\right) \cdot \left(z \cdot z\right) + \left(y \cdot 4\right) \cdot \left(-t\right)\right)}\]
  5. Using strategy rm
  6. Applied associate-*r*0.1

    \[\leadsto x \cdot x - \left(\color{blue}{\left(\left(y \cdot 4\right) \cdot z\right) \cdot z} + \left(y \cdot 4\right) \cdot \left(-t\right)\right)\]
  7. Final simplification0.1

    \[\leadsto x \cdot x - \left(\left(\left(y \cdot 4\right) \cdot z\right) \cdot z + \left(y \cdot 4\right) \cdot \left(-t\right)\right)\]

Reproduce

herbie shell --seed 2020128 
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :herbie-target
  (- (* x x) (* 4.0 (* y (- (* z z) t))))

  (- (* x x) (* (* y 4.0) (- (* z z) t))))