Average Error: 2.5 → 1.7
Time: 3.9s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.5167308587843438 \cdot 10^{54}:\\ \;\;\;\;x \cdot \left(\frac{\sin y}{y} \cdot \frac{1}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le 1.5167308587843438 \cdot 10^{54}:\\
\;\;\;\;x \cdot \left(\frac{\sin y}{y} \cdot \frac{1}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r428390 = x;
        double r428391 = y;
        double r428392 = sin(r428391);
        double r428393 = r428392 / r428391;
        double r428394 = r428390 * r428393;
        double r428395 = z;
        double r428396 = r428394 / r428395;
        return r428396;
}

double f(double x, double y, double z) {
        double r428397 = x;
        double r428398 = 1.5167308587843438e+54;
        bool r428399 = r428397 <= r428398;
        double r428400 = y;
        double r428401 = sin(r428400);
        double r428402 = r428401 / r428400;
        double r428403 = 1.0;
        double r428404 = z;
        double r428405 = r428403 / r428404;
        double r428406 = r428402 * r428405;
        double r428407 = r428397 * r428406;
        double r428408 = r428397 * r428401;
        double r428409 = r428403 / r428400;
        double r428410 = r428408 * r428409;
        double r428411 = r428410 / r428404;
        double r428412 = r428399 ? r428407 : r428411;
        return r428412;
}

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.5
Target0.3
Herbie1.7
\[\begin{array}{l} \mathbf{if}\;z \lt -4.21737202034271466 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1}{\frac{y}{\sin y}}}{z}\\ \mathbf{elif}\;z \lt 4.44670236911381103 \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.5167308587843438e+54

    1. Initial program 3.0

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

      \[\leadsto \color{blue}{\left(x \cdot \frac{\sin y}{y}\right) \cdot \frac{1}{z}}\]
    4. Using strategy rm
    5. Applied associate-*l*2.0

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

    if 1.5167308587843438e+54 < x

    1. Initial program 0.2

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

      \[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]
    4. Applied associate-*r*0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 1.5167308587843438 \cdot 10^{54}:\\ \;\;\;\;x \cdot \left(\frac{\sin y}{y} \cdot \frac{1}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot \sin y\right) \cdot \frac{1}{y}}{z}\\ \end{array}\]

Reproduce

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