Average Error: 2.6 → 1.0
Time: 5.5s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.8568993598992816 \cdot 10^{48} \lor \neg \left(z \le 1.34045888132617558 \cdot 10^{-169}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{z}}{y}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.8568993598992816 \cdot 10^{48} \lor \neg \left(z \le 1.34045888132617558 \cdot 10^{-169}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r1208794 = x;
        double r1208795 = y;
        double r1208796 = sin(r1208795);
        double r1208797 = r1208796 / r1208795;
        double r1208798 = r1208794 * r1208797;
        double r1208799 = z;
        double r1208800 = r1208798 / r1208799;
        return r1208800;
}

double f(double x, double y, double z) {
        double r1208801 = z;
        double r1208802 = -2.8568993598992816e+48;
        bool r1208803 = r1208801 <= r1208802;
        double r1208804 = 1.3404588813261756e-169;
        bool r1208805 = r1208801 <= r1208804;
        double r1208806 = !r1208805;
        bool r1208807 = r1208803 || r1208806;
        double r1208808 = x;
        double r1208809 = r1208808 / r1208801;
        double r1208810 = 1.0;
        double r1208811 = y;
        double r1208812 = sin(r1208811);
        double r1208813 = r1208812 / r1208811;
        double r1208814 = r1208810 / r1208813;
        double r1208815 = r1208809 / r1208814;
        double r1208816 = r1208812 / r1208801;
        double r1208817 = r1208816 / r1208811;
        double r1208818 = r1208808 * r1208817;
        double r1208819 = r1208807 ? r1208815 : r1208818;
        return r1208819;
}

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.0
\[\begin{array}{l} \mathbf{if}\;z \lt -4.21737202034271466 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.44670236911381103 \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 < -2.8568993598992816e+48 or 1.3404588813261756e-169 < z

    1. Initial program 0.8

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

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

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{1}{\frac{\sin y}{y}}}}\]
    6. Applied associate-/r*1.1

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

    if -2.8568993598992816e+48 < z < 1.3404588813261756e-169

    1. Initial program 6.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.8568993598992816 \cdot 10^{48} \lor \neg \left(z \le 1.34045888132617558 \cdot 10^{-169}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{z}}{y}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< z -4.2173720203427147e-29) (/ (* x (/ 1 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1 (/ y (sin y)))) z)))

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