Average Error: 2.6 → 1.7
Time: 15.8s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le 8.643245776965942508676671190095322059719 \cdot 10^{-110}:\\ \;\;\;\;\frac{x}{\frac{z}{\sin y \cdot \frac{1}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le 8.643245776965942508676671190095322059719 \cdot 10^{-110}:\\
\;\;\;\;\frac{x}{\frac{z}{\sin y \cdot \frac{1}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r338450 = x;
        double r338451 = y;
        double r338452 = sin(r338451);
        double r338453 = r338452 / r338451;
        double r338454 = r338450 * r338453;
        double r338455 = z;
        double r338456 = r338454 / r338455;
        return r338456;
}

double f(double x, double y, double z) {
        double r338457 = z;
        double r338458 = 8.643245776965943e-110;
        bool r338459 = r338457 <= r338458;
        double r338460 = x;
        double r338461 = y;
        double r338462 = sin(r338461);
        double r338463 = 1.0;
        double r338464 = r338463 / r338461;
        double r338465 = r338462 * r338464;
        double r338466 = r338457 / r338465;
        double r338467 = r338460 / r338466;
        double r338468 = r338460 / r338457;
        double r338469 = r338462 / r338461;
        double r338470 = r338468 * r338469;
        double r338471 = r338459 ? r338467 : r338470;
        return r338471;
}

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
Herbie1.7
\[\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 z < 8.643245776965943e-110

    1. Initial program 3.7

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied div-inv2.2

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{\sin y \cdot \frac{1}{y}}}}\]

    if 8.643245776965943e-110 < z

    1. Initial program 0.6

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 8.643245776965942508676671190095322059719 \cdot 10^{-110}:\\ \;\;\;\;\frac{x}{\frac{z}{\sin y \cdot \frac{1}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\sin y}{y}\\ \end{array}\]

Reproduce

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