Average Error: 2.9 → 1.0
Time: 4.3s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.6091788831885175 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{elif}\;z \le 9.28239712100140934 \cdot 10^{-126}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -6.6091788831885175 \cdot 10^{198}:\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\

\mathbf{elif}\;z \le 9.28239712100140934 \cdot 10^{-126}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r669083 = x;
        double r669084 = y;
        double r669085 = sin(r669084);
        double r669086 = r669085 / r669084;
        double r669087 = r669083 * r669086;
        double r669088 = z;
        double r669089 = r669087 / r669088;
        return r669089;
}

double f(double x, double y, double z) {
        double r669090 = z;
        double r669091 = -6.609178883188517e+198;
        bool r669092 = r669090 <= r669091;
        double r669093 = x;
        double r669094 = y;
        double r669095 = sin(r669094);
        double r669096 = 1.0;
        double r669097 = r669096 / r669094;
        double r669098 = r669095 * r669097;
        double r669099 = r669093 * r669098;
        double r669100 = r669099 / r669090;
        double r669101 = 9.282397121001409e-126;
        bool r669102 = r669090 <= r669101;
        double r669103 = r669095 / r669094;
        double r669104 = r669090 / r669103;
        double r669105 = r669093 / r669104;
        double r669106 = r669094 / r669095;
        double r669107 = r669096 / r669106;
        double r669108 = r669093 * r669107;
        double r669109 = r669108 / r669090;
        double r669110 = r669102 ? r669105 : r669109;
        double r669111 = r669092 ? r669100 : r669110;
        return r669111;
}

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.9
Target0.2
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 3 regimes
  2. if z < -6.609178883188517e+198

    1. Initial program 0.1

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied div-inv0.1

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

    if -6.609178883188517e+198 < z < 9.282397121001409e-126

    1. Initial program 4.9

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

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

    if 9.282397121001409e-126 < z

    1. Initial program 0.8

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied clear-num0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.6091788831885175 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{elif}\;z \le 9.28239712100140934 \cdot 10^{-126}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 
(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))