Average Error: 2.6 → 1.7
Time: 17.3s
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 r354105 = x;
        double r354106 = y;
        double r354107 = sin(r354106);
        double r354108 = r354107 / r354106;
        double r354109 = r354105 * r354108;
        double r354110 = z;
        double r354111 = r354109 / r354110;
        return r354111;
}

double f(double x, double y, double z) {
        double r354112 = z;
        double r354113 = 8.643245776965943e-110;
        bool r354114 = r354112 <= r354113;
        double r354115 = x;
        double r354116 = y;
        double r354117 = sin(r354116);
        double r354118 = 1.0;
        double r354119 = r354118 / r354116;
        double r354120 = r354117 * r354119;
        double r354121 = r354112 / r354120;
        double r354122 = r354115 / r354121;
        double r354123 = r354115 / r354112;
        double r354124 = r354117 / r354116;
        double r354125 = r354123 * r354124;
        double r354126 = r354114 ? r354122 : r354125;
        return r354126;
}

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 div-inv4.0

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{\sin y \cdot \frac{1}{y}}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity4.0

      \[\leadsto \frac{x}{\color{blue}{1 \cdot \frac{z}{\sin y \cdot \frac{1}{y}}}}\]
    8. Applied *-un-lft-identity4.0

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{1 \cdot \frac{z}{\sin y \cdot \frac{1}{y}}}\]
    9. Applied times-frac4.0

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{x}{\frac{z}{\sin y \cdot \frac{1}{y}}}}\]
    10. Simplified4.0

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\frac{z}{\sin y \cdot \frac{1}{y}}}\]
    11. Simplified0.7

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{x}{z} \cdot \frac{\sin y}{y}\right)}\]
  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 
(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))