Average Error: 6.0 → 0.5
Time: 9.9s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.303760412052484390435489424481917742401 \cdot 10^{-243} \lor \neg \left(x \cdot y \le 6.866383191027284350312248499135040834178 \cdot 10^{-240}\right) \land x \cdot y \le 8.123647290761479259839095592609619592255 \cdot 10^{143}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le -3.303760412052484390435489424481917742401 \cdot 10^{-243} \lor \neg \left(x \cdot y \le 6.866383191027284350312248499135040834178 \cdot 10^{-240}\right) \land x \cdot y \le 8.123647290761479259839095592609619592255 \cdot 10^{143}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r500063 = x;
        double r500064 = y;
        double r500065 = r500063 * r500064;
        double r500066 = z;
        double r500067 = r500065 / r500066;
        return r500067;
}

double f(double x, double y, double z) {
        double r500068 = x;
        double r500069 = y;
        double r500070 = r500068 * r500069;
        double r500071 = -inf.0;
        bool r500072 = r500070 <= r500071;
        double r500073 = z;
        double r500074 = r500069 / r500073;
        double r500075 = r500068 * r500074;
        double r500076 = -3.3037604120524844e-243;
        bool r500077 = r500070 <= r500076;
        double r500078 = 6.866383191027284e-240;
        bool r500079 = r500070 <= r500078;
        double r500080 = !r500079;
        double r500081 = 8.12364729076148e+143;
        bool r500082 = r500070 <= r500081;
        bool r500083 = r500080 && r500082;
        bool r500084 = r500077 || r500083;
        double r500085 = r500070 / r500073;
        double r500086 = r500073 / r500069;
        double r500087 = r500068 / r500086;
        double r500088 = r500084 ? r500085 : r500087;
        double r500089 = r500072 ? r500075 : r500088;
        return r500089;
}

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

Original6.0
Target6.0
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519428958560619200129306371776 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.704213066065047207696571404603247573308 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* x y) < -inf.0

    1. Initial program 64.0

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac0.2

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    5. Simplified0.2

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

    if -inf.0 < (* x y) < -3.3037604120524844e-243 or 6.866383191027284e-240 < (* x y) < 8.12364729076148e+143

    1. Initial program 0.2

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

    if -3.3037604120524844e-243 < (* x y) < 6.866383191027284e-240 or 8.12364729076148e+143 < (* x y)

    1. Initial program 13.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.303760412052484390435489424481917742401 \cdot 10^{-243} \lor \neg \left(x \cdot y \le 6.866383191027284350312248499135040834178 \cdot 10^{-240}\right) \land x \cdot y \le 8.123647290761479259839095592609619592255 \cdot 10^{143}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.70421306606504721e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))