Average Error: 2.6 → 0.3
Time: 5.7s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.39776791459329182580218143042860438466 \cdot 10^{-25} \lor \neg \left(x \le 8.137178980191325763102082751642143028499 \cdot 10^{-53}\right):\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -8.39776791459329182580218143042860438466 \cdot 10^{-25} \lor \neg \left(x \le 8.137178980191325763102082751642143028499 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r580345 = x;
        double r580346 = y;
        double r580347 = sin(r580346);
        double r580348 = r580347 / r580346;
        double r580349 = r580345 * r580348;
        double r580350 = z;
        double r580351 = r580349 / r580350;
        return r580351;
}

double f(double x, double y, double z) {
        double r580352 = x;
        double r580353 = -8.397767914593292e-25;
        bool r580354 = r580352 <= r580353;
        double r580355 = 8.137178980191326e-53;
        bool r580356 = r580352 <= r580355;
        double r580357 = !r580356;
        bool r580358 = r580354 || r580357;
        double r580359 = y;
        double r580360 = sin(r580359);
        double r580361 = r580352 * r580360;
        double r580362 = r580361 / r580359;
        double r580363 = z;
        double r580364 = r580362 / r580363;
        double r580365 = r580360 / r580359;
        double r580366 = r580363 / r580365;
        double r580367 = r580352 / r580366;
        double r580368 = r580358 ? r580364 : r580367;
        return r580368;
}

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.2
Herbie0.3
\[\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 < -8.397767914593292e-25 or 8.137178980191326e-53 < x

    1. Initial program 0.2

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

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

    if -8.397767914593292e-25 < x < 8.137178980191326e-53

    1. Initial program 5.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -8.39776791459329182580218143042860438466 \cdot 10^{-25} \lor \neg \left(x \le 8.137178980191325763102082751642143028499 \cdot 10^{-53}\right):\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \end{array}\]

Reproduce

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