Average Error: 2.9 → 0.2
Time: 46.3s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\sin y}{y} \cdot x \le -4.625916909407842 \cdot 10^{-220}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \mathbf{elif}\;\frac{\sin y}{y} \cdot x \le 6.171529664678782 \cdot 10^{-292}:\\ \;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;\frac{\sin y}{y} \cdot x \le -4.625916909407842 \cdot 10^{-220}:\\
\;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r18053245 = x;
        double r18053246 = y;
        double r18053247 = sin(r18053246);
        double r18053248 = r18053247 / r18053246;
        double r18053249 = r18053245 * r18053248;
        double r18053250 = z;
        double r18053251 = r18053249 / r18053250;
        return r18053251;
}

double f(double x, double y, double z) {
        double r18053252 = y;
        double r18053253 = sin(r18053252);
        double r18053254 = r18053253 / r18053252;
        double r18053255 = x;
        double r18053256 = r18053254 * r18053255;
        double r18053257 = -4.625916909407842e-220;
        bool r18053258 = r18053256 <= r18053257;
        double r18053259 = z;
        double r18053260 = r18053256 / r18053259;
        double r18053261 = 6.171529664678782e-292;
        bool r18053262 = r18053256 <= r18053261;
        double r18053263 = r18053255 / r18053259;
        double r18053264 = r18053254 * r18053263;
        double r18053265 = r18053262 ? r18053264 : r18053260;
        double r18053266 = r18053258 ? r18053260 : r18053265;
        return r18053266;
}

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.9
Target0.3
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;z \lt -4.2173720203427147 \cdot 10^{-29}:\\ \;\;\;\;\frac{x \cdot \frac{1.0}{\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.0}{\frac{y}{\sin y}}}{z}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* x (/ (sin y) y)) < -4.625916909407842e-220 or 6.171529664678782e-292 < (* x (/ (sin y) y))

    1. Initial program 0.2

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

    if -4.625916909407842e-220 < (* x (/ (sin y) y)) < 6.171529664678782e-292

    1. Initial program 11.7

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{\frac{\sin y}{y}}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sin y}{y} \cdot x \le -4.625916909407842 \cdot 10^{-220}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \mathbf{elif}\;\frac{\sin y}{y} \cdot x \le 6.171529664678782 \cdot 10^{-292}:\\ \;\;\;\;\frac{\sin y}{y} \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin y}{y} \cdot x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 +o rules:numerics
(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))