Average Error: 2.6 → 0.3
Time: 4.8s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.39776791459329182580218143042860438466 \cdot 10^{-25} \lor \neg \left(x \le 8.137178980191325763102082751642143028499 \cdot 10^{-53}\right):\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{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}\;x \le -8.39776791459329182580218143042860438466 \cdot 10^{-25} \lor \neg \left(x \le 8.137178980191325763102082751642143028499 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r383635 = x;
        double r383636 = y;
        double r383637 = sin(r383636);
        double r383638 = r383637 / r383636;
        double r383639 = r383635 * r383638;
        double r383640 = z;
        double r383641 = r383639 / r383640;
        return r383641;
}

double f(double x, double y, double z) {
        double r383642 = x;
        double r383643 = -8.397767914593292e-25;
        bool r383644 = r383642 <= r383643;
        double r383645 = 8.137178980191326e-53;
        bool r383646 = r383642 <= r383645;
        double r383647 = !r383646;
        bool r383648 = r383644 || r383647;
        double r383649 = y;
        double r383650 = sin(r383649);
        double r383651 = r383642 * r383650;
        double r383652 = r383651 / r383649;
        double r383653 = z;
        double r383654 = r383652 / r383653;
        double r383655 = r383650 / r383649;
        double r383656 = r383653 / r383655;
        double r383657 = r383642 / r383656;
        double r383658 = r383648 ? r383654 : r383657;
        return r383658;
}

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.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 < -8.397767914593292e-25 or 8.137178980191326e-53 < x

    1. Initial program 0.2

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

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

    if -8.397767914593292e-25 < x < 8.137178980191326e-53

    1. Initial program 5.1

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

      \[\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}\;x \le -8.39776791459329182580218143042860438466 \cdot 10^{-25} \lor \neg \left(x \le 8.137178980191325763102082751642143028499 \cdot 10^{-53}\right):\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]

Reproduce

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