Average Error: 2.9 → 0.3
Time: 15.3s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\sin y}{y} \cdot x \le -6.182207172159043856547251860467092831641 \cdot 10^{-302}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \mathbf{elif}\;\frac{\sin y}{y} \cdot x \le 3.551414181825400489773277543631131522703 \cdot 10^{-312}:\\ \;\;\;\;\frac{1}{\frac{y \cdot z}{x \cdot \sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \cdot x \le -6.182207172159043856547251860467092831641 \cdot 10^{-302}:\\
\;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\

\mathbf{elif}\;\frac{\sin y}{y} \cdot x \le 3.551414181825400489773277543631131522703 \cdot 10^{-312}:\\
\;\;\;\;\frac{1}{\frac{y \cdot z}{x \cdot \sin y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r20871978 = x;
        double r20871979 = y;
        double r20871980 = sin(r20871979);
        double r20871981 = r20871980 / r20871979;
        double r20871982 = r20871978 * r20871981;
        double r20871983 = z;
        double r20871984 = r20871982 / r20871983;
        return r20871984;
}

double f(double x, double y, double z) {
        double r20871985 = y;
        double r20871986 = sin(r20871985);
        double r20871987 = r20871986 / r20871985;
        double r20871988 = x;
        double r20871989 = r20871987 * r20871988;
        double r20871990 = -6.182207172159044e-302;
        bool r20871991 = r20871989 <= r20871990;
        double r20871992 = z;
        double r20871993 = r20871989 / r20871992;
        double r20871994 = 3.5514141818254e-312;
        bool r20871995 = r20871989 <= r20871994;
        double r20871996 = 1.0;
        double r20871997 = r20871985 * r20871992;
        double r20871998 = r20871988 * r20871986;
        double r20871999 = r20871997 / r20871998;
        double r20872000 = r20871996 / r20871999;
        double r20872001 = r20871995 ? r20872000 : r20871993;
        double r20872002 = r20871991 ? r20871993 : r20872001;
        return r20872002;
}

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.3
Herbie0.3
\[\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 (* x (/ (sin y) y)) < -6.182207172159044e-302 or 3.5514141818254e-312 < (* x (/ (sin y) y))

    1. Initial program 0.2

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

    if -6.182207172159044e-302 < (* x (/ (sin y) y)) < 3.5514141818254e-312

    1. Initial program 19.1

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot \frac{\sin y}{y}}}}\]
    4. Taylor expanded around inf 1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sin y}{y} \cdot x \le -6.182207172159043856547251860467092831641 \cdot 10^{-302}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \mathbf{elif}\;\frac{\sin y}{y} \cdot x \le 3.551414181825400489773277543631131522703 \cdot 10^{-312}:\\ \;\;\;\;\frac{1}{\frac{y \cdot z}{x \cdot \sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \end{array}\]

Reproduce

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

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

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