Average Error: 2.9 → 1.6
Time: 18.9s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le 9.374996475980067 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{y}}{\frac{1}{\sin y}} \cdot x}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le 9.374996475980067 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r22135060 = x;
        double r22135061 = y;
        double r22135062 = sin(r22135061);
        double r22135063 = r22135062 / r22135061;
        double r22135064 = r22135060 * r22135063;
        double r22135065 = z;
        double r22135066 = r22135064 / r22135065;
        return r22135066;
}

double f(double x, double y, double z) {
        double r22135067 = x;
        double r22135068 = 9.374996475980067e-85;
        bool r22135069 = r22135067 <= r22135068;
        double r22135070 = z;
        double r22135071 = y;
        double r22135072 = sin(r22135071);
        double r22135073 = r22135071 / r22135072;
        double r22135074 = r22135070 * r22135073;
        double r22135075 = r22135067 / r22135074;
        double r22135076 = 1.0;
        double r22135077 = r22135076 / r22135071;
        double r22135078 = r22135076 / r22135072;
        double r22135079 = r22135077 / r22135078;
        double r22135080 = r22135079 * r22135067;
        double r22135081 = r22135080 / r22135070;
        double r22135082 = r22135069 ? r22135075 : r22135081;
        return r22135082;
}

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
Herbie1.6
\[\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 < 9.374996475980067e-85

    1. Initial program 4.0

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    4. Using strategy rm
    5. Applied associate-/l*2.1

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

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

    if 9.374996475980067e-85 < x

    1. Initial program 0.5

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

      \[\leadsto \frac{x \cdot \color{blue}{\frac{1}{\frac{y}{\sin y}}}}{z}\]
    4. Using strategy rm
    5. Applied div-inv0.6

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

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

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

Reproduce

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