Average Error: 14.8 → 5.8
Time: 26.3s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.699374283935706957857036182841032710783 \cdot 10^{-111}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;t \le -9.622816168615241516473777822398600547529 \cdot 10^{-179}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;t \le 0.02009436619436608117972298259701346978545:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;t \le 1.676300908348856400628868413342405429055 \cdot 10^{85}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.699374283935706957857036182841032710783 \cdot 10^{-111}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;t \le -9.622816168615241516473777822398600547529 \cdot 10^{-179}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;t \le 0.02009436619436608117972298259701346978545:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;t \le 1.676300908348856400628868413342405429055 \cdot 10^{85}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r384648 = x;
        double r384649 = y;
        double r384650 = z;
        double r384651 = r384649 / r384650;
        double r384652 = t;
        double r384653 = r384651 * r384652;
        double r384654 = r384653 / r384652;
        double r384655 = r384648 * r384654;
        return r384655;
}

double f(double x, double y, double z, double t) {
        double r384656 = t;
        double r384657 = -1.699374283935707e-111;
        bool r384658 = r384656 <= r384657;
        double r384659 = x;
        double r384660 = y;
        double r384661 = r384659 * r384660;
        double r384662 = z;
        double r384663 = r384661 / r384662;
        double r384664 = -9.622816168615242e-179;
        bool r384665 = r384656 <= r384664;
        double r384666 = r384659 / r384662;
        double r384667 = r384660 * r384666;
        double r384668 = 0.02009436619436608;
        bool r384669 = r384656 <= r384668;
        double r384670 = 1.6763009083488564e+85;
        bool r384671 = r384656 <= r384670;
        double r384672 = r384662 / r384660;
        double r384673 = r384659 / r384672;
        double r384674 = r384671 ? r384667 : r384673;
        double r384675 = r384669 ? r384663 : r384674;
        double r384676 = r384665 ? r384667 : r384675;
        double r384677 = r384658 ? r384663 : r384676;
        return r384677;
}

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

Original14.8
Target1.6
Herbie5.8
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.206722051230450047215521150762600712224 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390632993316700759382836344 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415216825328199697215652986 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.008718050240713347941382056648619307142 \cdot 10^{217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -1.699374283935707e-111 or -9.622816168615242e-179 < t < 0.02009436619436608

    1. Initial program 15.1

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified6.6

      \[\leadsto \color{blue}{\frac{y}{z} \cdot x}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity6.6

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

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

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

    if -1.699374283935707e-111 < t < -9.622816168615242e-179 or 0.02009436619436608 < t < 1.6763009083488564e+85

    1. Initial program 9.9

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified5.8

      \[\leadsto \color{blue}{\frac{y}{z} \cdot x}\]
    3. Using strategy rm
    4. Applied div-inv5.9

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

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

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

    if 1.6763009083488564e+85 < t

    1. Initial program 17.4

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified6.5

      \[\leadsto \color{blue}{\frac{y}{z} \cdot x}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity6.5

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{x \cdot y}{z}}\]
    7. Using strategy rm
    8. Applied associate-/l*6.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.699374283935706957857036182841032710783 \cdot 10^{-111}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;t \le -9.622816168615241516473777822398600547529 \cdot 10^{-179}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;t \le 0.02009436619436608117972298259701346978545:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;t \le 1.676300908348856400628868413342405429055 \cdot 10^{85}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
  :precision binary64

  :herbie-target
  (if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))

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