Average Error: 2.0 → 2.3
Time: 7.0s
Precision: 64
\[\frac{x - y}{z - y} \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.23864684832811672 \cdot 10^{-67} \lor \neg \left(y \le 6.8251508594710119 \cdot 10^{-35}\right):\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \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}\;y \le -2.23864684832811672 \cdot 10^{-67} \lor \neg \left(y \le 6.8251508594710119 \cdot 10^{-35}\right):\\
\;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r468304 = x;
        double r468305 = y;
        double r468306 = r468304 - r468305;
        double r468307 = z;
        double r468308 = r468307 - r468305;
        double r468309 = r468306 / r468308;
        double r468310 = t;
        double r468311 = r468309 * r468310;
        return r468311;
}

double f(double x, double y, double z, double t) {
        double r468312 = y;
        double r468313 = -2.2386468483281167e-67;
        bool r468314 = r468312 <= r468313;
        double r468315 = 6.825150859471012e-35;
        bool r468316 = r468312 <= r468315;
        double r468317 = !r468316;
        bool r468318 = r468314 || r468317;
        double r468319 = x;
        double r468320 = z;
        double r468321 = r468320 - r468312;
        double r468322 = r468319 / r468321;
        double r468323 = r468312 / r468321;
        double r468324 = r468322 - r468323;
        double r468325 = t;
        double r468326 = r468324 * r468325;
        double r468327 = r468319 - r468312;
        double r468328 = r468325 / r468321;
        double r468329 = r468327 * r468328;
        double r468330 = r468318 ? r468326 : r468329;
        return r468330;
}

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.0
Target1.9
Herbie2.3
\[\frac{t}{\frac{z - y}{x - y}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -2.2386468483281167e-67 or 6.825150859471012e-35 < y

    1. Initial program 0.2

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-sub0.2

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

    if -2.2386468483281167e-67 < y < 6.825150859471012e-35

    1. Initial program 4.7

      \[\frac{x - y}{z - y} \cdot t\]
    2. Using strategy rm
    3. Applied div-inv4.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.23864684832811672 \cdot 10^{-67} \lor \neg \left(y \le 6.8251508594710119 \cdot 10^{-35}\right):\\ \;\;\;\;\left(\frac{x}{z - y} - \frac{y}{z - y}\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array}\]

Reproduce

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

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

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