Average Error: 2.8 → 1.0
Time: 19.3s
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{elif}\;x \le 1.5442293158046647 \cdot 10^{+242}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y \cdot x}{y}}{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{elif}\;x \le 1.5442293158046647 \cdot 10^{+242}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r22854981 = x;
        double r22854982 = y;
        double r22854983 = sin(r22854982);
        double r22854984 = r22854983 / r22854982;
        double r22854985 = r22854981 * r22854984;
        double r22854986 = z;
        double r22854987 = r22854985 / r22854986;
        return r22854987;
}

double f(double x, double y, double z) {
        double r22854988 = x;
        double r22854989 = -1.2889274271188022e+17;
        bool r22854990 = r22854988 <= r22854989;
        double r22854991 = y;
        double r22854992 = sin(r22854991);
        double r22854993 = r22854992 * r22854988;
        double r22854994 = r22854993 / r22854991;
        double r22854995 = z;
        double r22854996 = r22854994 / r22854995;
        double r22854997 = 1.5442293158046647e+242;
        bool r22854998 = r22854988 <= r22854997;
        double r22854999 = r22854992 / r22854991;
        double r22855000 = r22854995 / r22854999;
        double r22855001 = r22854988 / r22855000;
        double r22855002 = r22854998 ? r22855001 : r22854996;
        double r22855003 = r22854990 ? r22854996 : r22855002;
        return r22855003;
}

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.0
\[\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 or 1.5442293158046647e+242 < x

    1. Initial program 0.2

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.2

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

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

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

    if -1.2889274271188022e+17 < x < 1.5442293158046647e+242

    1. Initial program 3.6

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

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

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

Reproduce

herbie shell --seed 2019158 +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 (/ 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))