Average Error: 2.6 → 0.3
Time: 9.2s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.3033804533966324 \cdot 10^{-7} \lor \neg \left(x \le 7.1451913129313926 \cdot 10^{69}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -9.3033804533966324 \cdot 10^{-7} \lor \neg \left(x \le 7.1451913129313926 \cdot 10^{69}\right):\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r558786 = x;
        double r558787 = y;
        double r558788 = sin(r558787);
        double r558789 = r558788 / r558787;
        double r558790 = r558786 * r558789;
        double r558791 = z;
        double r558792 = r558790 / r558791;
        return r558792;
}

double f(double x, double y, double z) {
        double r558793 = x;
        double r558794 = -9.303380453396632e-07;
        bool r558795 = r558793 <= r558794;
        double r558796 = 7.145191312931393e+69;
        bool r558797 = r558793 <= r558796;
        double r558798 = !r558797;
        bool r558799 = r558795 || r558798;
        double r558800 = y;
        double r558801 = sin(r558800);
        double r558802 = r558801 / r558800;
        double r558803 = r558793 * r558802;
        double r558804 = z;
        double r558805 = r558803 / r558804;
        double r558806 = r558793 / r558804;
        double r558807 = r558800 / r558801;
        double r558808 = r558806 / r558807;
        double r558809 = r558799 ? r558805 : r558808;
        return r558809;
}

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.3
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 x < -9.303380453396632e-07 or 7.145191312931393e+69 < x

    1. Initial program 0.2

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

    if -9.303380453396632e-07 < x < 7.145191312931393e+69

    1. Initial program 4.3

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Simplified0.3

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{y}{\sin y}}}\]
    5. Using strategy rm
    6. Applied associate-/r*0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.3033804533966324 \cdot 10^{-7} \lor \neg \left(x \le 7.1451913129313926 \cdot 10^{69}\right):\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\ \end{array}\]

Reproduce

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