Average Error: 2.9 → 0.4
Time: 10.6s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.807101316999124 \cdot 10^{+93}:\\ \;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\ \mathbf{elif}\;x \le 0.0015208711258388175:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -4.807101316999124 \cdot 10^{+93}:\\
\;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\

\mathbf{elif}\;x \le 0.0015208711258388175:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r7475425 = x;
        double r7475426 = y;
        double r7475427 = sin(r7475426);
        double r7475428 = r7475427 / r7475426;
        double r7475429 = r7475425 * r7475428;
        double r7475430 = z;
        double r7475431 = r7475429 / r7475430;
        return r7475431;
}

double f(double x, double y, double z) {
        double r7475432 = x;
        double r7475433 = -4.807101316999124e+93;
        bool r7475434 = r7475432 <= r7475433;
        double r7475435 = 1.0;
        double r7475436 = y;
        double r7475437 = sin(r7475436);
        double r7475438 = r7475436 / r7475437;
        double r7475439 = r7475435 / r7475438;
        double r7475440 = r7475439 * r7475432;
        double r7475441 = z;
        double r7475442 = r7475440 / r7475441;
        double r7475443 = 0.0015208711258388175;
        bool r7475444 = r7475432 <= r7475443;
        double r7475445 = r7475437 / r7475436;
        double r7475446 = r7475441 / r7475445;
        double r7475447 = r7475432 / r7475446;
        double r7475448 = r7475444 ? r7475447 : r7475442;
        double r7475449 = r7475434 ? r7475442 : r7475448;
        return r7475449;
}

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.9
Target0.3
Herbie0.4
\[\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 < -4.807101316999124e+93 or 0.0015208711258388175 < x

    1. Initial program 0.2

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

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

    if -4.807101316999124e+93 < x < 0.0015208711258388175

    1. Initial program 4.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.807101316999124 \cdot 10^{+93}:\\ \;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\ \mathbf{elif}\;x \le 0.0015208711258388175:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{y}{\sin y}} \cdot x}{z}\\ \end{array}\]

Reproduce

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