Average Error: 2.7 → 1.6
Time: 17.7s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le 2.843405087967007653899124626840383149923 \cdot 10^{134}:\\ \;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le 2.843405087967007653899124626840383149923 \cdot 10^{134}:\\
\;\;\;\;\frac{x}{z \cdot \frac{y}{\sin y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r337644 = x;
        double r337645 = y;
        double r337646 = sin(r337645);
        double r337647 = r337646 / r337645;
        double r337648 = r337644 * r337647;
        double r337649 = z;
        double r337650 = r337648 / r337649;
        return r337650;
}

double f(double x, double y, double z) {
        double r337651 = x;
        double r337652 = 2.8434050879670077e+134;
        bool r337653 = r337651 <= r337652;
        double r337654 = z;
        double r337655 = y;
        double r337656 = sin(r337655);
        double r337657 = r337655 / r337656;
        double r337658 = r337654 * r337657;
        double r337659 = r337651 / r337658;
        double r337660 = r337651 * r337656;
        double r337661 = r337660 / r337655;
        double r337662 = r337661 / r337654;
        double r337663 = r337653 ? r337659 : r337662;
        return r337663;
}

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.7
Target0.3
Herbie1.6
\[\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 < 2.8434050879670077e+134

    1. Initial program 3.0

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

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

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

    if 2.8434050879670077e+134 < x

    1. Initial program 0.3

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied pow10.3

      \[\leadsto \frac{x \cdot \color{blue}{{\left(\frac{\sin y}{y}\right)}^{1}}}{z}\]
    4. Applied pow10.3

      \[\leadsto \frac{\color{blue}{{x}^{1}} \cdot {\left(\frac{\sin y}{y}\right)}^{1}}{z}\]
    5. Applied pow-prod-down0.3

      \[\leadsto \frac{\color{blue}{{\left(x \cdot \frac{\sin y}{y}\right)}^{1}}}{z}\]
    6. Simplified0.3

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

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

Reproduce

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