Average Error: 20.4 → 6.9
Time: 6.3s
Precision: binary64
\[\]
\[\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b < -1.71075788809424871e87

    1. Initial program 30.1

      \[\]
    2. Taylor expanded around inf 30.1

      \[\leadsto \]
    3. Simplified30.1

      \[\leadsto \]
    4. Taylor expanded around -inf 7.4

      \[\leadsto \]
    5. Simplified3.4

      \[\leadsto \]
    6. Taylor expanded around 0 3.4

      \[\leadsto \]
    7. Simplified3.4

      \[\leadsto \]
    8. Using strategy rm
    9. Applied add-exp-log3.4

      \[\leadsto \]

    if -1.71075788809424871e87 < b < 2.3540792276628007e82

    1. Initial program 9.2

      \[\]
    2. Simplified9.3

      \[\leadsto \]

    if 2.3540792276628007e82 < b

    1. Initial program 43.8

      \[\]
    2. Taylor expanded around inf 10.1

      \[\leadsto \]
    3. Simplified4.3

      \[\leadsto \]
    4. Taylor expanded around -inf 4.3

      \[\leadsto \]
    5. Simplified4.3

      \[\leadsto \]
    6. Taylor expanded around 0 4.1

      \[\leadsto \]
    7. Simplified4.1

      \[\leadsto \]
    8. Using strategy rm
    9. Applied add-sqr-sqrt4.1

      \[\leadsto \]
    10. Applied times-frac4.1

      \[\leadsto \]
    11. Simplified4.1

      \[\leadsto \]
    12. Simplified4.1

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.9

    \[\leadsto \]

Reproduce

herbie shell --seed 2020179 
(FPCore (a b c)
  :name "jeff quadratic root 1"
  :precision binary64
  (if (>= b 0.0) (/ (- (neg b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (neg b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))