Average Error: 2.3 → 0.4
Time: 16.0s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -2.544214561517923758805195215495225749795 \cdot 10^{302}:\\ \;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\ \mathbf{elif}\;\frac{x - y}{z - y} \le -2.255883818241031694480871714775758718908 \cdot 10^{-274} \lor \neg \left(\frac{x - y}{z - y} \le 1.942335659593579709608284822301914437699 \cdot 10^{-153}\right) \land \frac{x - y}{z - y} \le 5.779702072575541191674228138407204633316 \cdot 10^{148}:\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \le -2.544214561517923758805195215495225749795 \cdot 10^{302}:\\
\;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\

\mathbf{elif}\;\frac{x - y}{z - y} \le -2.255883818241031694480871714775758718908 \cdot 10^{-274} \lor \neg \left(\frac{x - y}{z - y} \le 1.942335659593579709608284822301914437699 \cdot 10^{-153}\right) \land \frac{x - y}{z - y} \le 5.779702072575541191674228138407204633316 \cdot 10^{148}:\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\

\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r363946 = x;
        double r363947 = y;
        double r363948 = r363946 - r363947;
        double r363949 = z;
        double r363950 = r363949 - r363947;
        double r363951 = r363948 / r363950;
        double r363952 = t;
        double r363953 = r363951 * r363952;
        return r363953;
}

double f(double x, double y, double z, double t) {
        double r363954 = x;
        double r363955 = y;
        double r363956 = r363954 - r363955;
        double r363957 = z;
        double r363958 = r363957 - r363955;
        double r363959 = r363956 / r363958;
        double r363960 = -2.5442145615179238e+302;
        bool r363961 = r363959 <= r363960;
        double r363962 = t;
        double r363963 = r363958 / r363962;
        double r363964 = r363956 / r363963;
        double r363965 = -2.2558838182410317e-274;
        bool r363966 = r363959 <= r363965;
        double r363967 = 1.9423356595935797e-153;
        bool r363968 = r363959 <= r363967;
        double r363969 = !r363968;
        double r363970 = 5.779702072575541e+148;
        bool r363971 = r363959 <= r363970;
        bool r363972 = r363969 && r363971;
        bool r363973 = r363966 || r363972;
        double r363974 = r363962 * r363959;
        double r363975 = r363962 / r363958;
        double r363976 = r363956 * r363975;
        double r363977 = r363973 ? r363974 : r363976;
        double r363978 = r363961 ? r363964 : r363977;
        return r363978;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.3
Target2.3
Herbie0.4
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (- x y) (- z y)) < -2.5442145615179238e+302

    1. Initial program 57.6

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied *-un-lft-identity57.6

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(x - y\right) \cdot t}{z - y}}\]
    6. Using strategy rm
    7. Applied associate-/l*0.3

      \[\leadsto 1 \cdot \color{blue}{\frac{x - y}{\frac{z - y}{t}}}\]

    if -2.5442145615179238e+302 < (/ (- x y) (- z y)) < -2.2558838182410317e-274 or 1.9423356595935797e-153 < (/ (- x y) (- z y)) < 5.779702072575541e+148

    1. Initial program 0.2

      \[\frac{x - y}{z - y} \cdot t\]

    if -2.2558838182410317e-274 < (/ (- x y) (- z y)) < 1.9423356595935797e-153 or 5.779702072575541e+148 < (/ (- x y) (- z y))

    1. Initial program 10.2

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

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

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x - y}{z - y} \cdot t\right)}\]
    5. Simplified1.8

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(x - y\right) \cdot t}{z - y}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity1.8

      \[\leadsto 1 \cdot \frac{\left(x - y\right) \cdot t}{\color{blue}{1 \cdot \left(z - y\right)}}\]
    8. Applied times-frac1.5

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{x - y}{1} \cdot \frac{t}{z - y}\right)}\]
    9. Simplified1.5

      \[\leadsto 1 \cdot \left(\color{blue}{\left(x - y\right)} \cdot \frac{t}{z - y}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \le -2.544214561517923758805195215495225749795 \cdot 10^{302}:\\ \;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\ \mathbf{elif}\;\frac{x - y}{z - y} \le -2.255883818241031694480871714775758718908 \cdot 10^{-274} \lor \neg \left(\frac{x - y}{z - y} \le 1.942335659593579709608284822301914437699 \cdot 10^{-153}\right) \land \frac{x - y}{z - y} \le 5.779702072575541191674228138407204633316 \cdot 10^{148}:\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"

  :herbie-target
  (/ t (/ (- z y) (- x y)))

  (* (/ (- x y) (- z y)) t))