Average Error: 0.1 → 0.1
Time: 21.5s
Precision: 64
\[x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)\]
\[\mathsf{fma}\left(x, 0.5, y \cdot \left(\mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left(\sqrt[3]{z}\right)\right)\right)\]
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\mathsf{fma}\left(x, 0.5, y \cdot \left(\mathsf{fma}\left(2, \log \left(\sqrt[3]{z}\right), 1 - z\right) + \log \left(\sqrt[3]{z}\right)\right)\right)
double f(double x, double y, double z) {
        double r207244 = x;
        double r207245 = 0.5;
        double r207246 = r207244 * r207245;
        double r207247 = y;
        double r207248 = 1.0;
        double r207249 = z;
        double r207250 = r207248 - r207249;
        double r207251 = log(r207249);
        double r207252 = r207250 + r207251;
        double r207253 = r207247 * r207252;
        double r207254 = r207246 + r207253;
        return r207254;
}

double f(double x, double y, double z) {
        double r207255 = x;
        double r207256 = 0.5;
        double r207257 = y;
        double r207258 = 2.0;
        double r207259 = z;
        double r207260 = cbrt(r207259);
        double r207261 = log(r207260);
        double r207262 = 1.0;
        double r207263 = r207262 - r207259;
        double r207264 = fma(r207258, r207261, r207263);
        double r207265 = r207264 + r207261;
        double r207266 = r207257 * r207265;
        double r207267 = fma(r207255, r207256, r207266);
        return r207267;
}

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 add-cube-cbrt0.1

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

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

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

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

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

Reproduce

herbie shell --seed 2019323 +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)))))