Average Error: 7.2 → 6.6
Time: 55.2s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le 6.625574720452708 \cdot 10^{+86}:\\ \;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\\ \mathbf{if}\;a \le 2.7445378437622284 \cdot 10^{+195}:\\ \;\;\;\;\sqrt[3]{-1} \cdot \left(t \cdot \frac{z}{a} - x \cdot \frac{y}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\\ \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.2
Target5.8
Herbie6.6
\[\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 < 6.625574720452708e+86 or 2.7445378437622284e+195 < a

    1. Initial program 6.7

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-inv6.8

      \[\leadsto \color{blue}{\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}}\]

    if 6.625574720452708e+86 < a < 2.7445378437622284e+195

    1. Initial program 11.2

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt12.0

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x \cdot y - z \cdot t} \cdot \sqrt[3]{x \cdot y - z \cdot t}\right) \cdot \sqrt[3]{x \cdot y - z \cdot t}}}{a}\]
    4. Applied associate-/l*12.0

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x \cdot y - z \cdot t} \cdot \sqrt[3]{x \cdot y - z \cdot t}}{\frac{a}{\sqrt[3]{x \cdot y - z \cdot t}}}}\]
    5. Taylor expanded around 0 62.7

      \[\leadsto \color{blue}{\frac{z \cdot t}{a} \cdot {-1}^{\frac{1}{3}} - \frac{y \cdot x}{a} \cdot {-1}^{\frac{1}{3}}}\]
    6. Applied simplify4.8

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

Runtime

Time bar (total: 55.2s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"

  :herbie-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))