Average Error: 2.8 → 1.6
Time: 14.1s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le 4.04058555517106442439703059130784734804 \cdot 10^{60}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\frac{y}{\sin y}}}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;z \le 4.04058555517106442439703059130784734804 \cdot 10^{60}:\\
\;\;\;\;x \cdot \frac{\frac{\sin y}{y}}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r301210 = x;
        double r301211 = y;
        double r301212 = sin(r301211);
        double r301213 = r301212 / r301211;
        double r301214 = r301210 * r301213;
        double r301215 = z;
        double r301216 = r301214 / r301215;
        return r301216;
}

double f(double x, double y, double z) {
        double r301217 = z;
        double r301218 = 4.0405855551710644e+60;
        bool r301219 = r301217 <= r301218;
        double r301220 = x;
        double r301221 = y;
        double r301222 = sin(r301221);
        double r301223 = r301222 / r301221;
        double r301224 = r301223 / r301217;
        double r301225 = r301220 * r301224;
        double r301226 = r301221 / r301222;
        double r301227 = r301220 / r301226;
        double r301228 = r301227 / r301217;
        double r301229 = r301219 ? r301225 : r301228;
        return r301229;
}

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.8
Target0.3
Herbie1.6
\[\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 z < 4.0405855551710644e+60

    1. Initial program 3.6

      \[\frac{x \cdot \frac{\sin y}{y}}{z}\]
    2. Simplified2.0

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

    if 4.0405855551710644e+60 < z

    1. Initial program 0.1

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

      \[\leadsto \frac{x \cdot \frac{\sin y}{y}}{\color{blue}{1 \cdot z}}\]
    4. Applied associate-/r*0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 4.04058555517106442439703059130784734804 \cdot 10^{60}:\\ \;\;\;\;x \cdot \frac{\frac{\sin y}{y}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Reproduce

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