Average Error: 0.1 → 0.1
Time: 5.5s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(x, 0.5, \left(1 - \left(z - 2 \cdot \log \left(\sqrt[3]{z}\right)\right)\right) \cdot y + y \cdot \log \left(\sqrt[3]{z}\right)\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\mathsf{fma}\left(x, 0.5, \left(1 - \left(z - 2 \cdot \log \left(\sqrt[3]{z}\right)\right)\right) \cdot y + y \cdot \log \left(\sqrt[3]{z}\right)\right)
double f(double x, double y, double z) {
        double r299900 = x;
        double r299901 = 0.5;
        double r299902 = r299900 * r299901;
        double r299903 = y;
        double r299904 = 1.0;
        double r299905 = z;
        double r299906 = r299904 - r299905;
        double r299907 = log(r299905);
        double r299908 = r299906 + r299907;
        double r299909 = r299903 * r299908;
        double r299910 = r299902 + r299909;
        return r299910;
}

double f(double x, double y, double z) {
        double r299911 = x;
        double r299912 = 0.5;
        double r299913 = 1.0;
        double r299914 = z;
        double r299915 = 2.0;
        double r299916 = cbrt(r299914);
        double r299917 = log(r299916);
        double r299918 = r299915 * r299917;
        double r299919 = r299914 - r299918;
        double r299920 = r299913 - r299919;
        double r299921 = y;
        double r299922 = r299920 * r299921;
        double r299923 = r299921 * r299917;
        double r299924 = r299922 + r299923;
        double r299925 = fma(r299911, r299912, r299924);
        return r299925;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original0.1
Target0.1
Herbie0.1
\[\left(y + 0.5 \cdot x\right) - y \cdot \left(z - \log z\right)\]

Derivation

  1. Initial program 0.1

    \[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5, y \cdot \left(\left(1 - z\right) + \log z\right)\right)}\]
  3. Using strategy rm
  4. Applied distribute-lft-in0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{y \cdot \left(1 - z\right) + y \cdot \log z}\right)\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, y \cdot \left(1 - z\right) + y \cdot \log \color{blue}{\left(\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}\right)}\right)\]
  7. Applied log-prod0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, y \cdot \left(1 - z\right) + y \cdot \color{blue}{\left(\log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) + \log \left(\sqrt[3]{z}\right)\right)}\right)\]
  8. Applied distribute-lft-in0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, y \cdot \left(1 - z\right) + \color{blue}{\left(y \cdot \log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) + y \cdot \log \left(\sqrt[3]{z}\right)\right)}\right)\]
  9. Applied associate-+r+0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{\left(y \cdot \left(1 - z\right) + y \cdot \log \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + y \cdot \log \left(\sqrt[3]{z}\right)}\right)\]
  10. Simplified0.1

    \[\leadsto \mathsf{fma}\left(x, 0.5, \color{blue}{\left(1 - \left(z - 2 \cdot \log \left(\sqrt[3]{z}\right)\right)\right) \cdot y} + y \cdot \log \left(\sqrt[3]{z}\right)\right)\]
  11. Final simplification0.1

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

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(FPCore (x y z)
  :name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
  :precision binary64

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

  (+ (* x 0.5) (* y (+ (- 1 z) (log z)))))