Average Error: 2.4 → 1.1
Time: 16.8s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.230194912459417 \cdot 10^{+102}:\\ \;\;\;\;\frac{\frac{1}{y} \cdot \left(\sin y \cdot x\right)}{z}\\ \mathbf{elif}\;x \le 5.118933034108623 \cdot 10^{-123}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y} \cdot \left(\sin y \cdot x\right)}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -8.230194912459417 \cdot 10^{+102}:\\
\;\;\;\;\frac{\frac{1}{y} \cdot \left(\sin y \cdot x\right)}{z}\\

\mathbf{elif}\;x \le 5.118933034108623 \cdot 10^{-123}:\\
\;\;\;\;x \cdot \frac{\frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r23556145 = x;
        double r23556146 = y;
        double r23556147 = sin(r23556146);
        double r23556148 = r23556147 / r23556146;
        double r23556149 = r23556145 * r23556148;
        double r23556150 = z;
        double r23556151 = r23556149 / r23556150;
        return r23556151;
}

double f(double x, double y, double z) {
        double r23556152 = x;
        double r23556153 = -8.230194912459417e+102;
        bool r23556154 = r23556152 <= r23556153;
        double r23556155 = 1.0;
        double r23556156 = y;
        double r23556157 = r23556155 / r23556156;
        double r23556158 = sin(r23556156);
        double r23556159 = r23556158 * r23556152;
        double r23556160 = r23556157 * r23556159;
        double r23556161 = z;
        double r23556162 = r23556160 / r23556161;
        double r23556163 = 5.118933034108623e-123;
        bool r23556164 = r23556152 <= r23556163;
        double r23556165 = r23556158 / r23556156;
        double r23556166 = r23556165 / r23556161;
        double r23556167 = r23556152 * r23556166;
        double r23556168 = r23556164 ? r23556167 : r23556162;
        double r23556169 = r23556154 ? r23556162 : r23556168;
        return r23556169;
}

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.4
Target0.3
Herbie1.1
\[\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 < -8.230194912459417e+102 or 5.118933034108623e-123 < x

    1. Initial program 0.7

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

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

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

    if -8.230194912459417e+102 < x < 5.118933034108623e-123

    1. Initial program 3.9

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity3.9

      \[\leadsto \frac{x \cdot \frac{\sin y}{y}}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac0.6

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{\frac{\sin y}{y}}{z}}\]
    5. Simplified0.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -8.230194912459417 \cdot 10^{+102}:\\ \;\;\;\;\frac{\frac{1}{y} \cdot \left(\sin y \cdot x\right)}{z}\\ \mathbf{elif}\;x \le 5.118933034108623 \cdot 10^{-123}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y} \cdot \left(\sin y \cdot x\right)}{z}\\ \end{array}\]

Reproduce

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