Average Error: 2.6 → 0.7
Time: 5.8s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.1179437477253498797497071716188107059 \cdot 10^{-81} \lor \neg \left(x \le 5.715011145653865345597923439061032092042 \cdot 10^{-24}\right):\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -4.1179437477253498797497071716188107059 \cdot 10^{-81} \lor \neg \left(x \le 5.715011145653865345597923439061032092042 \cdot 10^{-24}\right):\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r544505 = x;
        double r544506 = y;
        double r544507 = sin(r544506);
        double r544508 = r544507 / r544506;
        double r544509 = r544505 * r544508;
        double r544510 = z;
        double r544511 = r544509 / r544510;
        return r544511;
}

double f(double x, double y, double z) {
        double r544512 = x;
        double r544513 = -4.11794374772535e-81;
        bool r544514 = r544512 <= r544513;
        double r544515 = 5.715011145653865e-24;
        bool r544516 = r544512 <= r544515;
        double r544517 = !r544516;
        bool r544518 = r544514 || r544517;
        double r544519 = y;
        double r544520 = sin(r544519);
        double r544521 = 1.0;
        double r544522 = r544521 / r544519;
        double r544523 = r544520 * r544522;
        double r544524 = r544512 * r544523;
        double r544525 = z;
        double r544526 = r544524 / r544525;
        double r544527 = r544525 / r544512;
        double r544528 = r544520 / r544519;
        double r544529 = r544527 / r544528;
        double r544530 = r544521 / r544529;
        double r544531 = r544518 ? r544526 : r544530;
        return r544531;
}

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.7
\[\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 < -4.11794374772535e-81 or 5.715011145653865e-24 < x

    1. Initial program 0.5

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied div-inv0.6

      \[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]

    if -4.11794374772535e-81 < x < 5.715011145653865e-24

    1. Initial program 5.3

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied div-inv5.4

      \[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]
    4. Using strategy rm
    5. Applied clear-num5.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.1179437477253498797497071716188107059 \cdot 10^{-81} \lor \neg \left(x \le 5.715011145653865345597923439061032092042 \cdot 10^{-24}\right):\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{\frac{\sin y}{y}}}\\ \end{array}\]

Reproduce

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