Average Error: 2.4 → 1.1
Time: 15.6s
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 r23884947 = x;
        double r23884948 = y;
        double r23884949 = sin(r23884948);
        double r23884950 = r23884949 / r23884948;
        double r23884951 = r23884947 * r23884950;
        double r23884952 = z;
        double r23884953 = r23884951 / r23884952;
        return r23884953;
}

double f(double x, double y, double z) {
        double r23884954 = x;
        double r23884955 = -8.230194912459417e+102;
        bool r23884956 = r23884954 <= r23884955;
        double r23884957 = 1.0;
        double r23884958 = y;
        double r23884959 = r23884957 / r23884958;
        double r23884960 = sin(r23884958);
        double r23884961 = r23884960 * r23884954;
        double r23884962 = r23884959 * r23884961;
        double r23884963 = z;
        double r23884964 = r23884962 / r23884963;
        double r23884965 = 5.118933034108623e-123;
        bool r23884966 = r23884954 <= r23884965;
        double r23884967 = r23884960 / r23884958;
        double r23884968 = r23884967 / r23884963;
        double r23884969 = r23884954 * r23884968;
        double r23884970 = r23884966 ? r23884969 : r23884964;
        double r23884971 = r23884956 ? r23884964 : r23884970;
        return r23884971;
}

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))