Average Error: 11.3 → 4.2
Time: 12.1s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -7.9867195007645 \cdot 10^{-272}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 1.1237088963810616 \cdot 10^{+288}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.3
Target11.3
Herbie4.2
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -7.9867195007645e-272 or -0.0 < (/ (* a1 a2) (* b1 b2)) < 1.1237088963810616e+288

    1. Initial program 4.3

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]

    if -7.9867195007645e-272 < (/ (* a1 a2) (* b1 b2)) < -0.0 or 1.1237088963810616e+288 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 21.7

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification4.0

      \[\leadsto \frac{a1}{b2} \cdot \frac{a2}{b1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -7.9867195007645 \cdot 10^{-272}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 1.1237088963810616 \cdot 10^{+288}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \end{array}\]

Runtime

Time bar (total: 12.1s)Debug logProfile

herbie shell --seed 2018251 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

  :herbie-target
  (* (/ a1 b1) (/ a2 b2))

  (/ (* a1 a2) (* b1 b2)))