Average Error: 2.8 → 1.4
Time: 14.0s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.2889274271188022 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{\sin y} \cdot z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -1.2889274271188022 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r12589828 = x;
        double r12589829 = y;
        double r12589830 = sin(r12589829);
        double r12589831 = r12589830 / r12589829;
        double r12589832 = r12589828 * r12589831;
        double r12589833 = z;
        double r12589834 = r12589832 / r12589833;
        return r12589834;
}

double f(double x, double y, double z) {
        double r12589835 = x;
        double r12589836 = -1.2889274271188022e+17;
        bool r12589837 = r12589835 <= r12589836;
        double r12589838 = y;
        double r12589839 = sin(r12589838);
        double r12589840 = r12589839 * r12589835;
        double r12589841 = r12589840 / r12589838;
        double r12589842 = z;
        double r12589843 = r12589841 / r12589842;
        double r12589844 = r12589838 / r12589839;
        double r12589845 = r12589844 * r12589842;
        double r12589846 = r12589835 / r12589845;
        double r12589847 = r12589837 ? r12589843 : r12589846;
        return r12589847;
}

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.8
Target0.2
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;z \lt -4.2173720203427147 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.446702369113811 \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 < -1.2889274271188022e+17

    1. Initial program 0.2

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

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

    if -1.2889274271188022e+17 < x

    1. Initial program 3.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity1.7

      \[\leadsto \frac{x}{\frac{z}{\frac{\sin y}{\color{blue}{1 \cdot y}}}}\]
    6. Applied *-un-lft-identity1.7

      \[\leadsto \frac{x}{\frac{z}{\frac{\color{blue}{1 \cdot \sin y}}{1 \cdot y}}}\]
    7. Applied times-frac1.7

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

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{1} \cdot \frac{\sin y}{y}}}\]
    9. Using strategy rm
    10. Applied div-inv1.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.2889274271188022 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{\sin y} \cdot z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"

  :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))