Average Error: 14.0 → 0.7
Time: 25.9s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.009555688743657053093976996432682877192 \cdot 10^{278}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.900141742787772715345890115335440787699 \cdot 10^{-270}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 4.438182973596565301288302827093808047147 \cdot 10^{-272}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 3.561199608254915194562496763078682553454 \cdot 10^{97}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -1.009555688743657053093976996432682877192 \cdot 10^{278}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 3.561199608254915194562496763078682553454 \cdot 10^{97}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r68290 = x;
        double r68291 = y;
        double r68292 = z;
        double r68293 = r68291 / r68292;
        double r68294 = t;
        double r68295 = r68293 * r68294;
        double r68296 = r68295 / r68294;
        double r68297 = r68290 * r68296;
        return r68297;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r68298 = y;
        double r68299 = z;
        double r68300 = r68298 / r68299;
        double r68301 = -1.009555688743657e+278;
        bool r68302 = r68300 <= r68301;
        double r68303 = x;
        double r68304 = r68303 / r68299;
        double r68305 = r68298 * r68304;
        double r68306 = -1.9001417427877727e-270;
        bool r68307 = r68300 <= r68306;
        double r68308 = r68299 / r68298;
        double r68309 = r68303 / r68308;
        double r68310 = 4.438182973596565e-272;
        bool r68311 = r68300 <= r68310;
        double r68312 = r68303 * r68298;
        double r68313 = r68312 / r68299;
        double r68314 = 3.561199608254915e+97;
        bool r68315 = r68300 <= r68314;
        double r68316 = 1.0;
        double r68317 = r68316 / r68298;
        double r68318 = r68304 / r68317;
        double r68319 = r68315 ? r68309 : r68318;
        double r68320 = r68311 ? r68313 : r68319;
        double r68321 = r68307 ? r68309 : r68320;
        double r68322 = r68302 ? r68305 : r68321;
        return r68322;
}

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

Derivation

  1. Split input into 4 regimes
  2. if (/ y z) < -1.009555688743657e+278

    1. Initial program 54.6

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified45.9

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

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

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

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

    if -1.009555688743657e+278 < (/ y z) < -1.9001417427877727e-270 or 4.438182973596565e-272 < (/ y z) < 3.561199608254915e+97

    1. Initial program 8.2

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

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

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

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

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

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

    if -1.9001417427877727e-270 < (/ y z) < 4.438182973596565e-272

    1. Initial program 18.9

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

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

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

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

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

    if 3.561199608254915e+97 < (/ y z)

    1. Initial program 26.4

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

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{x}{\frac{z}{y}}}\]
    9. Using strategy rm
    10. Applied div-inv11.8

      \[\leadsto 1 \cdot \frac{x}{\color{blue}{z \cdot \frac{1}{y}}}\]
    11. Applied associate-/r*4.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.009555688743657053093976996432682877192 \cdot 10^{278}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.900141742787772715345890115335440787699 \cdot 10^{-270}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 4.438182973596565301288302827093808047147 \cdot 10^{-272}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 3.561199608254915194562496763078682553454 \cdot 10^{97}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y}}\\ \end{array}\]

Reproduce

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