Average Error: 6.3 → 0.1
Time: 18.2s
Precision: 64
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
\[x \cdot x - \left(4 \cdot \left(z \cdot \left(z \cdot y\right)\right) + \left(-4 \cdot \left(t \cdot y\right)\right)\right)\]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
x \cdot x - \left(4 \cdot \left(z \cdot \left(z \cdot y\right)\right) + \left(-4 \cdot \left(t \cdot y\right)\right)\right)
double f(double x, double y, double z, double t) {
        double r388650 = x;
        double r388651 = r388650 * r388650;
        double r388652 = y;
        double r388653 = 4.0;
        double r388654 = r388652 * r388653;
        double r388655 = z;
        double r388656 = r388655 * r388655;
        double r388657 = t;
        double r388658 = r388656 - r388657;
        double r388659 = r388654 * r388658;
        double r388660 = r388651 - r388659;
        return r388660;
}

double f(double x, double y, double z, double t) {
        double r388661 = x;
        double r388662 = r388661 * r388661;
        double r388663 = 4.0;
        double r388664 = z;
        double r388665 = y;
        double r388666 = r388664 * r388665;
        double r388667 = r388664 * r388666;
        double r388668 = r388663 * r388667;
        double r388669 = t;
        double r388670 = r388669 * r388665;
        double r388671 = r388663 * r388670;
        double r388672 = -r388671;
        double r388673 = r388668 + r388672;
        double r388674 = r388662 - r388673;
        return r388674;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.3
Target6.3
Herbie0.1
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Derivation

  1. Initial program 6.3

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

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

    \[\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. Simplified6.3

    \[\leadsto x \cdot x - \left(\color{blue}{4 \cdot \left({z}^{2} \cdot y\right)} + \left(y \cdot 4\right) \cdot \left(-t\right)\right)\]
  6. Simplified6.3

    \[\leadsto x \cdot x - \left(4 \cdot \left({z}^{2} \cdot y\right) + \color{blue}{\left(-4 \cdot \left(t \cdot y\right)\right)}\right)\]
  7. Using strategy rm
  8. Applied unpow26.3

    \[\leadsto x \cdot x - \left(4 \cdot \left(\color{blue}{\left(z \cdot z\right)} \cdot y\right) + \left(-4 \cdot \left(t \cdot y\right)\right)\right)\]
  9. Applied associate-*l*0.1

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

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

Reproduce

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

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

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