Average Error: 7.4 → 5.2
Time: 21.6s
Precision: 64
Internal precision: 128
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -5.7933311388628865 \cdot 10^{+190}:\\ \;\;\;\;\frac{y}{\frac{a}{x}} - \frac{z}{\frac{a}{t}}\\ \mathbf{if}\;a \le 3.8124686331119876 \cdot 10^{+40}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a}{x}} - \frac{z}{\frac{a}{t}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original7.4
Comparison5.7
Herbie5.2
\[ \begin{array}{l} \mathbf{if}\;z \lt -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{if}\;z \lt 6.309831121978371 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \end{array} \]

Derivation

  1. Split input into 2 regimes.
  2. if a < -5.7933311388628865e+190 or 3.8124686331119876e+40 < a

    1. Initial program 12.4

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Applied taylor 12.4

      \[\leadsto \frac{y \cdot x}{a} - \frac{z \cdot t}{a}\]
    3. Taylor expanded around 0 12.4

      \[\leadsto \color{blue}{\frac{y \cdot x}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied associate-/l* 10.3

      \[\leadsto \color{blue}{\frac{y}{\frac{a}{x}}} - \frac{z \cdot t}{a}\]
    6. Using strategy rm
    7. Applied associate-/l* 7.0

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

    if -5.7933311388628865e+190 < a < 3.8124686331119876e+40

    1. Initial program 3.8

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied clear-num 3.9

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{x \cdot y - z \cdot t}}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 21.6s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(824151755 2405658847 3886254275 1998256265 327824978 334083030)'
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"

  :target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

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