Average Error: 2.6 → 0.3
Time: 4.6s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.28657606638248286 \cdot 10^{-6} \lor \neg \left(z \le 1.7877667366727078 \cdot 10^{-79}\right):\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le -2.28657606638248286 \cdot 10^{-6} \lor \neg \left(z \le 1.7877667366727078 \cdot 10^{-79}\right):\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r454858 = x;
        double r454859 = y;
        double r454860 = sin(r454859);
        double r454861 = r454860 / r454859;
        double r454862 = r454858 * r454861;
        double r454863 = z;
        double r454864 = r454862 / r454863;
        return r454864;
}

double f(double x, double y, double z) {
        double r454865 = z;
        double r454866 = -2.286576066382483e-06;
        bool r454867 = r454865 <= r454866;
        double r454868 = 1.7877667366727078e-79;
        bool r454869 = r454865 <= r454868;
        double r454870 = !r454869;
        bool r454871 = r454867 || r454870;
        double r454872 = x;
        double r454873 = y;
        double r454874 = sin(r454873);
        double r454875 = 1.0;
        double r454876 = r454875 / r454873;
        double r454877 = r454874 * r454876;
        double r454878 = r454872 * r454877;
        double r454879 = r454878 / r454865;
        double r454880 = r454874 / r454873;
        double r454881 = r454865 / r454880;
        double r454882 = r454872 / r454881;
        double r454883 = r454871 ? r454879 : r454882;
        return r454883;
}

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.2
Herbie0.3
\[\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.286576066382483e-06 or 1.7877667366727078e-79 < z

    1. Initial program 0.3

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

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

    if -2.286576066382483e-06 < z < 1.7877667366727078e-79

    1. Initial program 6.5

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

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

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

Reproduce

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