Average Error: 2.6 → 0.7
Time: 5.7s
Precision: 64
\[\frac{x \cdot \frac{\sin y}{y}}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.1179437477253498797497071716188107059 \cdot 10^{-81} \lor \neg \left(x \le 5.715011145653865345597923439061032092042 \cdot 10^{-24}\right):\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{\frac{\sin y}{y}}}\\ \end{array}\]
\frac{x \cdot \frac{\sin y}{y}}{z}
\begin{array}{l}
\mathbf{if}\;x \le -4.1179437477253498797497071716188107059 \cdot 10^{-81} \lor \neg \left(x \le 5.715011145653865345597923439061032092042 \cdot 10^{-24}\right):\\
\;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r543190 = x;
        double r543191 = y;
        double r543192 = sin(r543191);
        double r543193 = r543192 / r543191;
        double r543194 = r543190 * r543193;
        double r543195 = z;
        double r543196 = r543194 / r543195;
        return r543196;
}

double f(double x, double y, double z) {
        double r543197 = x;
        double r543198 = -4.11794374772535e-81;
        bool r543199 = r543197 <= r543198;
        double r543200 = 5.715011145653865e-24;
        bool r543201 = r543197 <= r543200;
        double r543202 = !r543201;
        bool r543203 = r543199 || r543202;
        double r543204 = y;
        double r543205 = sin(r543204);
        double r543206 = 1.0;
        double r543207 = r543206 / r543204;
        double r543208 = r543205 * r543207;
        double r543209 = r543197 * r543208;
        double r543210 = z;
        double r543211 = r543209 / r543210;
        double r543212 = r543210 / r543197;
        double r543213 = r543205 / r543204;
        double r543214 = r543212 / r543213;
        double r543215 = r543206 / r543214;
        double r543216 = r543203 ? r543211 : r543215;
        return r543216;
}

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.7
\[\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 x < -4.11794374772535e-81 or 5.715011145653865e-24 < x

    1. Initial program 0.5

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

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

    if -4.11794374772535e-81 < x < 5.715011145653865e-24

    1. Initial program 5.3

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

      \[\leadsto \frac{x \cdot \color{blue}{\left(\sin y \cdot \frac{1}{y}\right)}}{z}\]
    4. Using strategy rm
    5. Applied clear-num5.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.1179437477253498797497071716188107059 \cdot 10^{-81} \lor \neg \left(x \le 5.715011145653865345597923439061032092042 \cdot 10^{-24}\right):\\ \;\;\;\;\frac{x \cdot \left(\sin y \cdot \frac{1}{y}\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{\frac{\sin y}{y}}}\\ \end{array}\]

Reproduce

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