Average Error: 0.4 → 0.2
Time: 19.1s
Precision: 64
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\]
\[\mathsf{fma}\left(y - x, 6 \cdot \mathsf{fma}\left(\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}}, \frac{2}{\sqrt[3]{3}}, -z\right), x\right)\]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\mathsf{fma}\left(y - x, 6 \cdot \mathsf{fma}\left(\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}}, \frac{2}{\sqrt[3]{3}}, -z\right), x\right)
double f(double x, double y, double z) {
        double r172840 = x;
        double r172841 = y;
        double r172842 = r172841 - r172840;
        double r172843 = 6.0;
        double r172844 = r172842 * r172843;
        double r172845 = 2.0;
        double r172846 = 3.0;
        double r172847 = r172845 / r172846;
        double r172848 = z;
        double r172849 = r172847 - r172848;
        double r172850 = r172844 * r172849;
        double r172851 = r172840 + r172850;
        return r172851;
}

double f(double x, double y, double z) {
        double r172852 = y;
        double r172853 = x;
        double r172854 = r172852 - r172853;
        double r172855 = 6.0;
        double r172856 = 1.0;
        double r172857 = 3.0;
        double r172858 = cbrt(r172857);
        double r172859 = r172858 * r172858;
        double r172860 = r172856 / r172859;
        double r172861 = 2.0;
        double r172862 = r172861 / r172858;
        double r172863 = z;
        double r172864 = -r172863;
        double r172865 = fma(r172860, r172862, r172864);
        double r172866 = r172855 * r172865;
        double r172867 = fma(r172854, r172866, r172853);
        return r172867;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.4

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{3} - z\right), x\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.2

    \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \left(\frac{2}{\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}}} - z\right), x\right)\]
  5. Applied *-un-lft-identity0.2

    \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \left(\frac{\color{blue}{1 \cdot 2}}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}} - z\right), x\right)\]
  6. Applied times-frac0.2

    \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \left(\color{blue}{\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \frac{2}{\sqrt[3]{3}}} - z\right), x\right)\]
  7. Applied fma-neg0.2

    \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}}, \frac{2}{\sqrt[3]{3}}, -z\right)}, x\right)\]
  8. Final simplification0.2

    \[\leadsto \mathsf{fma}\left(y - x, 6 \cdot \mathsf{fma}\left(\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}}, \frac{2}{\sqrt[3]{3}}, -z\right), x\right)\]

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
  :precision binary64
  (+ x (* (* (- y x) 6) (- (/ 2 3) z))))