Average Error: 2.7 → 0.2
Time: 4.0s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \le -2.2420082536324771 \cdot 10^{-303} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 2.53370143623 \cdot 10^{-314}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{z}}{y}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot \frac{\sin y}{y} \le -2.2420082536324771 \cdot 10^{-303} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 2.53370143623 \cdot 10^{-314}\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r450143 = x;
        double r450144 = y;
        double r450145 = sin(r450144);
        double r450146 = r450145 / r450144;
        double r450147 = r450143 * r450146;
        double r450148 = z;
        double r450149 = r450147 / r450148;
        return r450149;
}

double f(double x, double y, double z) {
        double r450150 = x;
        double r450151 = y;
        double r450152 = sin(r450151);
        double r450153 = r450152 / r450151;
        double r450154 = r450150 * r450153;
        double r450155 = -2.242008253632477e-303;
        bool r450156 = r450154 <= r450155;
        double r450157 = 2.5337014362254e-314;
        bool r450158 = r450154 <= r450157;
        double r450159 = !r450158;
        bool r450160 = r450156 || r450159;
        double r450161 = z;
        double r450162 = r450154 / r450161;
        double r450163 = r450150 * r450152;
        double r450164 = r450163 / r450161;
        double r450165 = r450164 / r450151;
        double r450166 = r450160 ? r450162 : r450165;
        return r450166;
}

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.7
Target0.3
Herbie0.2
\[\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 (* x (/ (sin y) y)) < -2.242008253632477e-303 or 2.5337014362254e-314 < (* x (/ (sin y) y))

    1. Initial program 0.2

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]

    if -2.242008253632477e-303 < (* x (/ (sin y) y)) < 2.5337014362254e-314

    1. Initial program 17.9

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

      \[\leadsto \color{blue}{\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}}\]
    4. Using strategy rm
    5. Applied associate-*r/18.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \frac{\sin y}{y} \le -2.2420082536324771 \cdot 10^{-303} \lor \neg \left(x \cdot \frac{\sin y}{y} \le 2.53370143623 \cdot 10^{-314}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{z}}{y}\\ \end{array}\]

Reproduce

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