Average Error: 14.1 → 3.5
Time: 15.8s
Precision: 64
Internal Precision: 128
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.515307948004962 \cdot 10^{-203}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 5.9800147274783734 \cdot 10^{-210}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \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) < -6.515307948004962e-203 or 5.9800147274783734e-210 < (/ y z)

    1. Initial program 13.0

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

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

    if -6.515307948004962e-203 < (/ y z) < 5.9800147274783734e-210

    1. Initial program 17.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.515307948004962 \cdot 10^{-203}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 5.9800147274783734 \cdot 10^{-210}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2019068 +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)))