
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if b < -1.22e112Initial program 50.3%
Simplified50.2%
Taylor expanded in b around inf 50.2%
fma-def50.2%
associate-/l*50.2%
*-commutative50.2%
Simplified50.2%
Taylor expanded in b around -inf 95.1%
associate-*r/95.4%
cancel-sign-sub-inv95.4%
metadata-eval95.4%
*-un-lft-identity95.4%
Applied egg-rr95.4%
Taylor expanded in c around inf 95.4%
if -1.22e112 < b < 1e104Initial program 85.3%
if 1e104 < b Initial program 60.5%
Simplified60.5%
Taylor expanded in b around inf 90.1%
fma-def90.1%
associate-/l*98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in b around -inf 98.4%
div-inv98.4%
clear-num98.4%
Applied egg-rr98.4%
Final simplification90.6%
if b < -1e114Initial program 50.3%
Simplified50.2%
Taylor expanded in b around inf 50.2%
fma-def50.2%
associate-/l*50.2%
*-commutative50.2%
Simplified50.2%
Taylor expanded in b around -inf 95.1%
associate-*r/95.4%
cancel-sign-sub-inv95.4%
metadata-eval95.4%
*-un-lft-identity95.4%
Applied egg-rr95.4%
Taylor expanded in c around inf 95.4%
if -1e114 < b < 1.3600000000000001e-150Initial program 84.8%
expm1-log1p-u78.0%
expm1-udef69.9%
*-commutative69.9%
add-sqr-sqrt65.6%
sqrt-unprod69.8%
sqr-neg69.8%
sqrt-prod69.9%
add-sqr-sqrt69.9%
*-commutative69.9%
*-commutative69.9%
Applied egg-rr69.9%
expm1-def77.9%
expm1-log1p84.5%
associate-*r/84.5%
Simplified84.5%
if 1.3600000000000001e-150 < b Initial program 71.5%
Simplified71.5%
Taylor expanded in b around inf 81.2%
fma-def81.2%
associate-/l*86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in b around -inf 86.0%
div-inv86.0%
clear-num86.0%
Applied egg-rr86.0%
Final simplification87.6%
Initial program 71.5%
Simplified71.4%
Taylor expanded in b around inf 68.8%
fma-def68.8%
associate-/l*70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around -inf 72.9%
associate-*r/73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
*-un-lft-identity73.1%
Applied egg-rr73.1%
div-inv72.9%
clear-num72.9%
Applied egg-rr73.1%
Final simplification73.1%
Initial program 71.5%
Simplified71.4%
Taylor expanded in b around inf 68.8%
fma-def68.8%
associate-/l*70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around -inf 72.9%
associate-*r/73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
*-un-lft-identity73.1%
Applied egg-rr73.1%
Taylor expanded in c around inf 40.1%
Final simplification40.1%
Initial program 71.5%
Simplified71.4%
Taylor expanded in b around inf 68.8%
fma-def68.8%
associate-/l*70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in b around -inf 72.9%
associate-*r/73.1%
cancel-sign-sub-inv73.1%
metadata-eval73.1%
*-un-lft-identity73.1%
Applied egg-rr73.1%
Taylor expanded in c around 0 73.0%
associate-*r/73.0%
neg-mul-173.0%
Simplified73.0%
Final simplification73.0%
herbie shell --seed 2023167
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))