Average Error: 2.6 → 0.4
Time: 16.9s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -21934061023014455604714685600852303140620000:\\ \;\;\;\;\frac{1}{z} \cdot \left(\frac{\sin y}{y} \cdot x\right)\\ \mathbf{elif}\;x \le 3.8662219941802638253842348368985834299 \cdot 10^{104}:\\ \;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\sin y \cdot x\right) \cdot \frac{1}{y}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -21934061023014455604714685600852303140620000:\\
\;\;\;\;\frac{1}{z} \cdot \left(\frac{\sin y}{y} \cdot x\right)\\

\mathbf{elif}\;x \le 3.8662219941802638253842348368985834299 \cdot 10^{104}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{\sin y}{y}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r24080456 = x;
        double r24080457 = y;
        double r24080458 = sin(r24080457);
        double r24080459 = r24080458 / r24080457;
        double r24080460 = r24080456 * r24080459;
        double r24080461 = z;
        double r24080462 = r24080460 / r24080461;
        return r24080462;
}

double f(double x, double y, double z) {
        double r24080463 = x;
        double r24080464 = -2.1934061023014456e+43;
        bool r24080465 = r24080463 <= r24080464;
        double r24080466 = 1.0;
        double r24080467 = z;
        double r24080468 = r24080466 / r24080467;
        double r24080469 = y;
        double r24080470 = sin(r24080469);
        double r24080471 = r24080470 / r24080469;
        double r24080472 = r24080471 * r24080463;
        double r24080473 = r24080468 * r24080472;
        double r24080474 = 3.866221994180264e+104;
        bool r24080475 = r24080463 <= r24080474;
        double r24080476 = r24080467 / r24080471;
        double r24080477 = r24080463 / r24080476;
        double r24080478 = r24080470 * r24080463;
        double r24080479 = r24080466 / r24080469;
        double r24080480 = r24080478 * r24080479;
        double r24080481 = r24080480 / r24080467;
        double r24080482 = r24080475 ? r24080477 : r24080481;
        double r24080483 = r24080465 ? r24080473 : r24080482;
        return r24080483;
}

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.4
\[\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 3 regimes
  2. if x < -2.1934061023014456e+43

    1. Initial program 0.2

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

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

    if -2.1934061023014456e+43 < x < 3.866221994180264e+104

    1. Initial program 3.8

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

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

    if 3.866221994180264e+104 < 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 3 regimes into one program.
  4. Final simplification0.4

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

Reproduce

herbie shell --seed 2019171 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctanh from linear-1.19.1.3"

  :herbie-target
  (if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))

  (/ (* x (/ (sin y) y)) z))