Average Error: 6.3 → 0.5
Time: 10.9s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -5.44063564524967612 \cdot 10^{-183}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 2.7243815378783738 \cdot 10^{-256}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{elif}\;x \cdot y \le -5.44063564524967612 \cdot 10^{-183}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\mathbf{elif}\;x \cdot y \le 2.7243815378783738 \cdot 10^{-256}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r836985 = x;
        double r836986 = y;
        double r836987 = r836985 * r836986;
        double r836988 = z;
        double r836989 = r836987 / r836988;
        return r836989;
}

double f(double x, double y, double z) {
        double r836990 = x;
        double r836991 = y;
        double r836992 = r836990 * r836991;
        double r836993 = -1.0091301852710854e+193;
        bool r836994 = r836992 <= r836993;
        double r836995 = z;
        double r836996 = r836995 / r836991;
        double r836997 = r836990 / r836996;
        double r836998 = -5.440635645249676e-183;
        bool r836999 = r836992 <= r836998;
        double r837000 = 1.0;
        double r837001 = r837000 / r836995;
        double r837002 = r836992 * r837001;
        double r837003 = 2.724381537878374e-256;
        bool r837004 = r836992 <= r837003;
        double r837005 = 9.811295412498549e+171;
        bool r837006 = r836992 <= r837005;
        double r837007 = r836991 / r836995;
        double r837008 = r836990 * r837007;
        double r837009 = r837006 ? r837002 : r837008;
        double r837010 = r837004 ? r836997 : r837009;
        double r837011 = r836999 ? r837002 : r837010;
        double r837012 = r836994 ? r836997 : r837011;
        return r837012;
}

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.3
Target6.2
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.70421306606504721 \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) < -1.0091301852710854e+193 or -5.440635645249676e-183 < (* x y) < 2.724381537878374e-256

    1. Initial program 14.6

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

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

    if -1.0091301852710854e+193 < (* x y) < -5.440635645249676e-183 or 2.724381537878374e-256 < (* x y) < 9.811295412498549e+171

    1. Initial program 0.2

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

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

    if 9.811295412498549e+171 < (* x y)

    1. Initial program 22.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -5.44063564524967612 \cdot 10^{-183}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 2.7243815378783738 \cdot 10^{-256}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020045 
(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.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))