Average Error: 2.6 → 0.2
Time: 18.5s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6.724218585312992324531933263642713427544 \lor \neg \left(x \le 276756884396063653888\right):\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -6.724218585312992324531933263642713427544 \lor \neg \left(x \le 276756884396063653888\right):\\
\;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\

\end{array}
double f(double x, double y, double z) {
        double r411236 = x;
        double r411237 = y;
        double r411238 = sin(r411237);
        double r411239 = r411238 / r411237;
        double r411240 = r411236 * r411239;
        double r411241 = z;
        double r411242 = r411240 / r411241;
        return r411242;
}

double f(double x, double y, double z) {
        double r411243 = x;
        double r411244 = -6.724218585312992;
        bool r411245 = r411243 <= r411244;
        double r411246 = 2.7675688439606365e+20;
        bool r411247 = r411243 <= r411246;
        double r411248 = !r411247;
        bool r411249 = r411245 || r411248;
        double r411250 = y;
        double r411251 = sin(r411250);
        double r411252 = r411243 * r411251;
        double r411253 = r411252 / r411250;
        double r411254 = z;
        double r411255 = r411253 / r411254;
        double r411256 = r411250 / r411251;
        double r411257 = r411254 * r411256;
        double r411258 = r411243 / r411257;
        double r411259 = r411249 ? r411255 : r411258;
        return r411259;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.6
Target0.3
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;z \lt -4.217372020342714661850238929213415773451 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.446702369113811028051510715777703865332 \cdot 10^{64}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -6.724218585312992 or 2.7675688439606365e+20 < x

    1. Initial program 0.2

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied pow10.2

      \[\leadsto \frac{x \cdot \color{blue}{{\left(\frac{\sin y}{y}\right)}^{1}}}{z}\]
    4. Applied pow10.2

      \[\leadsto \frac{\color{blue}{{x}^{1}} \cdot {\left(\frac{\sin y}{y}\right)}^{1}}{z}\]
    5. Applied pow-prod-down0.2

      \[\leadsto \frac{\color{blue}{{\left(x \cdot \frac{\sin y}{y}\right)}^{1}}}{z}\]
    6. Simplified0.3

      \[\leadsto \frac{{\color{blue}{\left(\frac{x \cdot \sin y}{y}\right)}}^{1}}{z}\]

    if -6.724218585312992 < x < 2.7675688439606365e+20

    1. Initial program 4.4

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*0.2

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Simplified0.2

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{y}{\sin y}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -6.724218585312992324531933263642713427544 \lor \neg \left(x \le 276756884396063653888\right):\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019306 +o rules:numerics
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< z -4.21737202034271466e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.44670236911381103e64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))

  (/ (* x (/ (sin y) y)) z))