Average Error: 13.7 → 3.1
Time: 15.5s
Precision: 64
Internal Precision: 128
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -4.58115826387339 \cdot 10^{-285}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 2.2692925812077 \cdot 10^{-313}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Split input into 2 regimes
  2. if (/ y z) < -4.58115826387339e-285 or 2.2692925812077e-313 < (/ y z)

    1. Initial program 12.7

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

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

    if -4.58115826387339e-285 < (/ y z) < 2.2692925812077e-313

    1. Initial program 19.4

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied clear-num19.0

      \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{y}}}\]
    5. Applied un-div-inv19.0

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    6. Using strategy rm
    7. Applied associate-/r/0.1

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity0.1

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{z} \cdot y\]
    10. Applied associate-/l*0.1

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

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

      \[\leadsto \frac{\color{blue}{y}}{\frac{z}{x}}\]
    13. Taylor expanded around inf 0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -4.58115826387339 \cdot 10^{-285}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 2.2692925812077 \cdot 10^{-313}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

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