Average Error: 46.2 → 45.4
Time: 32.9s
Precision: 64
\[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\]
\[\log \left(e^{\cos \left(\left(b \cdot t\right) \cdot 0.0625\right)}\right) \cdot \left(\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\left(\frac{z}{16} \cdot t\right) \cdot 1\right)\right)\right) \cdot \cos \left(\left(\frac{z}{16} \cdot t\right) \cdot \left(2 \cdot y\right)\right) - \sin \left(\left(\frac{z}{16} \cdot t\right) \cdot \left(2 \cdot y\right)\right) \cdot \sin \left(\left(\frac{z}{16} \cdot t\right) \cdot 1\right)\right) \cdot x\right)\]
\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)
\log \left(e^{\cos \left(\left(b \cdot t\right) \cdot 0.0625\right)}\right) \cdot \left(\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\left(\frac{z}{16} \cdot t\right) \cdot 1\right)\right)\right) \cdot \cos \left(\left(\frac{z}{16} \cdot t\right) \cdot \left(2 \cdot y\right)\right) - \sin \left(\left(\frac{z}{16} \cdot t\right) \cdot \left(2 \cdot y\right)\right) \cdot \sin \left(\left(\frac{z}{16} \cdot t\right) \cdot 1\right)\right) \cdot x\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r25668121 = x;
        double r25668122 = y;
        double r25668123 = 2.0;
        double r25668124 = r25668122 * r25668123;
        double r25668125 = 1.0;
        double r25668126 = r25668124 + r25668125;
        double r25668127 = z;
        double r25668128 = r25668126 * r25668127;
        double r25668129 = t;
        double r25668130 = r25668128 * r25668129;
        double r25668131 = 16.0;
        double r25668132 = r25668130 / r25668131;
        double r25668133 = cos(r25668132);
        double r25668134 = r25668121 * r25668133;
        double r25668135 = a;
        double r25668136 = r25668135 * r25668123;
        double r25668137 = r25668136 + r25668125;
        double r25668138 = b;
        double r25668139 = r25668137 * r25668138;
        double r25668140 = r25668139 * r25668129;
        double r25668141 = r25668140 / r25668131;
        double r25668142 = cos(r25668141);
        double r25668143 = r25668134 * r25668142;
        return r25668143;
}

double f(double x, double y, double z, double t, double __attribute__((unused)) a, double b) {
        double r25668144 = b;
        double r25668145 = t;
        double r25668146 = r25668144 * r25668145;
        double r25668147 = 0.0625;
        double r25668148 = r25668146 * r25668147;
        double r25668149 = cos(r25668148);
        double r25668150 = exp(r25668149);
        double r25668151 = log(r25668150);
        double r25668152 = z;
        double r25668153 = 16.0;
        double r25668154 = r25668152 / r25668153;
        double r25668155 = r25668154 * r25668145;
        double r25668156 = 1.0;
        double r25668157 = r25668155 * r25668156;
        double r25668158 = cos(r25668157);
        double r25668159 = expm1(r25668158);
        double r25668160 = log1p(r25668159);
        double r25668161 = 2.0;
        double r25668162 = y;
        double r25668163 = r25668161 * r25668162;
        double r25668164 = r25668155 * r25668163;
        double r25668165 = cos(r25668164);
        double r25668166 = r25668160 * r25668165;
        double r25668167 = sin(r25668164);
        double r25668168 = sin(r25668157);
        double r25668169 = r25668167 * r25668168;
        double r25668170 = r25668166 - r25668169;
        double r25668171 = x;
        double r25668172 = r25668170 * r25668171;
        double r25668173 = r25668151 * r25668172;
        return r25668173;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original46.2
Target44.3
Herbie45.4
\[x \cdot \cos \left(\frac{b}{16} \cdot \frac{t}{\left(1 - a \cdot 2\right) + {\left(a \cdot 2\right)}^{2}}\right)\]

Derivation

  1. Initial program 46.2

    \[\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\]
  2. Simplified45.5

    \[\leadsto \color{blue}{\left(\cos \left(\left(\frac{z}{16} \cdot t\right) \cdot \mathsf{fma}\left(2, y, 1\right)\right) \cdot x\right) \cdot \cos \left(\left(\frac{b}{16} \cdot t\right) \cdot \mathsf{fma}\left(a, 2, 1\right)\right)}\]
  3. Taylor expanded around 0 45.3

    \[\leadsto \left(\cos \left(\left(\frac{z}{16} \cdot t\right) \cdot \mathsf{fma}\left(2, y, 1\right)\right) \cdot x\right) \cdot \cos \color{blue}{\left(0.0625 \cdot \left(t \cdot b\right)\right)}\]
  4. Using strategy rm
  5. Applied fma-udef45.3

    \[\leadsto \left(\cos \left(\left(\frac{z}{16} \cdot t\right) \cdot \color{blue}{\left(2 \cdot y + 1\right)}\right) \cdot x\right) \cdot \cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\]
  6. Applied distribute-rgt-in45.3

    \[\leadsto \left(\cos \color{blue}{\left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right) + 1 \cdot \left(\frac{z}{16} \cdot t\right)\right)} \cdot x\right) \cdot \cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\]
  7. Applied cos-sum45.4

    \[\leadsto \left(\color{blue}{\left(\cos \left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right)\right) \cdot \cos \left(1 \cdot \left(\frac{z}{16} \cdot t\right)\right) - \sin \left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right)\right) \cdot \sin \left(1 \cdot \left(\frac{z}{16} \cdot t\right)\right)\right)} \cdot x\right) \cdot \cos \left(0.0625 \cdot \left(t \cdot b\right)\right)\]
  8. Using strategy rm
  9. Applied add-log-exp45.4

    \[\leadsto \left(\left(\cos \left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right)\right) \cdot \cos \left(1 \cdot \left(\frac{z}{16} \cdot t\right)\right) - \sin \left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right)\right) \cdot \sin \left(1 \cdot \left(\frac{z}{16} \cdot t\right)\right)\right) \cdot x\right) \cdot \color{blue}{\log \left(e^{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)}\right)}\]
  10. Using strategy rm
  11. Applied log1p-expm1-u45.4

    \[\leadsto \left(\left(\cos \left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right)\right) \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(1 \cdot \left(\frac{z}{16} \cdot t\right)\right)\right)\right)} - \sin \left(\left(2 \cdot y\right) \cdot \left(\frac{z}{16} \cdot t\right)\right) \cdot \sin \left(1 \cdot \left(\frac{z}{16} \cdot t\right)\right)\right) \cdot x\right) \cdot \log \left(e^{\cos \left(0.0625 \cdot \left(t \cdot b\right)\right)}\right)\]
  12. Final simplification45.4

    \[\leadsto \log \left(e^{\cos \left(\left(b \cdot t\right) \cdot 0.0625\right)}\right) \cdot \left(\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\left(\frac{z}{16} \cdot t\right) \cdot 1\right)\right)\right) \cdot \cos \left(\left(\frac{z}{16} \cdot t\right) \cdot \left(2 \cdot y\right)\right) - \sin \left(\left(\frac{z}{16} \cdot t\right) \cdot \left(2 \cdot y\right)\right) \cdot \sin \left(\left(\frac{z}{16} \cdot t\right) \cdot 1\right)\right) \cdot x\right)\]

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x y z t a b)
  :name "Codec.Picture.Jpg.FastDct:referenceDct from JuicyPixels-3.2.6.1"

  :herbie-target
  (* x (cos (* (/ b 16.0) (/ t (+ (- 1.0 (* a 2.0)) (pow (* a 2.0) 2.0))))))

  (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))