Average Error: 3.0 → 1.8
Time: 36.2s
Precision: 64
Internal precision: 128
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.7570734968756763 \cdot 10^{+120}:\\ \;\;\;\;z \cdot y + \left(z \cdot \left(b \cdot a\right) + a \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot y + x\right) + \left(b \cdot z + t\right) \cdot a\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original3.0
Comparison1.5
Herbie1.8
\[ \begin{array}{l} \mathbf{if}\;z \lt -1.1820553527347888 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{if}\;z \lt 4.7589743188364287 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \end{array} \]

Derivation

  1. Split input into 2 regimes.
  2. if z < -1.7570734968756763e+120

    1. Initial program 19.5

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Applied simplify 21.6

      \[\leadsto \color{blue}{\left(z \cdot y + x\right) + \left(b \cdot z + t\right) \cdot a}\]
    3. Applied taylor 0.1

      \[\leadsto z \cdot y + \left(z \cdot \left(b \cdot a\right) + a \cdot t\right)\]
    4. Taylor expanded around inf 0.1

      \[\leadsto \color{blue}{z \cdot y + \left(z \cdot \left(b \cdot a\right) + a \cdot t\right)}\]

    if -1.7570734968756763e+120 < z

    1. Initial program 1.4

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Applied simplify 2.0

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

Runtime

Time bar (total: 36.2s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1155861525 2976023767 2229427605 1257832866 1576552063 3568085888)'
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"

  :target
  (if (< z -1.1820553527347888e+19) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))