Average Error: 2.6 → 0.2
Time: 6.0s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.3033804533966324 \cdot 10^{-7}:\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{elif}\;x \le 4.0553809354711968 \cdot 10^{-43}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -9.3033804533966324 \cdot 10^{-7}:\\
\;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r669183 = x;
        double r669184 = y;
        double r669185 = sin(r669184);
        double r669186 = r669185 / r669184;
        double r669187 = r669183 * r669186;
        double r669188 = z;
        double r669189 = r669187 / r669188;
        return r669189;
}

double f(double x, double y, double z) {
        double r669190 = x;
        double r669191 = -9.303380453396632e-07;
        bool r669192 = r669190 <= r669191;
        double r669193 = y;
        double r669194 = sin(r669193);
        double r669195 = r669194 / r669193;
        double r669196 = r669190 * r669195;
        double r669197 = z;
        double r669198 = r669196 / r669197;
        double r669199 = 4.055380935471197e-43;
        bool r669200 = r669190 <= r669199;
        double r669201 = r669190 / r669197;
        double r669202 = r669193 / r669194;
        double r669203 = r669201 / r669202;
        double r669204 = r669190 * r669194;
        double r669205 = r669204 / r669193;
        double r669206 = r669205 / r669197;
        double r669207 = r669200 ? r669203 : r669206;
        double r669208 = r669192 ? r669198 : r669207;
        return r669208;
}

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.2
\[\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 3 regimes
  2. if x < -9.303380453396632e-07

    1. Initial program 0.2

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]

    if -9.303380453396632e-07 < x < 4.055380935471197e-43

    1. Initial program 5.0

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

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

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

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{y}{\sin y}}}\]
    7. Using strategy rm
    8. Applied associate-/r*0.1

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

    if 4.055380935471197e-43 < x

    1. Initial program 0.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.3033804533966324 \cdot 10^{-7}:\\ \;\;\;\;\frac{x \cdot \frac{\sin y}{y}}{z}\\ \mathbf{elif}\;x \le 4.0553809354711968 \cdot 10^{-43}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y}{\sin y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot \sin y}{y}}{z}\\ \end{array}\]

Reproduce

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