
Results
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
| Original | 52.6% |
|---|---|
| Target | 99.7% |
| Herbie | 99.7% |
Initial program 53.0%
flip--53.8%
div-inv53.8%
add-sqr-sqrt53.7%
add-sqr-sqrt54.2%
Applied egg-rr54.2%
associate-*r/54.2%
*-rgt-identity54.2%
remove-double-neg54.2%
sub-neg54.2%
div-sub53.1%
rem-square-sqrt52.9%
sqr-neg52.9%
div-sub53.7%
sqr-neg53.7%
+-commutative53.7%
rem-square-sqrt54.2%
associate--l+99.7%
+-inverses99.7%
metadata-eval99.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.7%
if (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) < 1.00000000000000005e-4Initial program 5.8%
flip3--4.3%
div-inv4.3%
sqrt-pow24.2%
metadata-eval4.2%
sqrt-pow24.4%
metadata-eval4.4%
add-sqr-sqrt4.4%
add-sqr-sqrt4.4%
associate-+r+4.4%
sqrt-unprod4.4%
Applied egg-rr4.4%
Taylor expanded in x around inf 98.8%
*-commutative98.8%
Simplified98.8%
expm1-log1p-u98.8%
expm1-udef7.8%
inv-pow7.8%
sqrt-pow17.8%
metadata-eval7.8%
Applied egg-rr7.8%
expm1-def99.0%
expm1-log1p99.0%
Simplified99.0%
if 1.00000000000000005e-4 < (-.f64 (sqrt.f64 (+.f64 x 1)) (sqrt.f64 x)) Initial program 99.5%
Final simplification99.3%
if x < 1Initial program 100.0%
Taylor expanded in x around 0 98.7%
+-commutative98.7%
associate--l+98.7%
*-commutative98.7%
Applied egg-rr98.7%
if 1 < x Initial program 8.3%
flip3--6.8%
div-inv6.8%
sqrt-pow26.7%
metadata-eval6.7%
sqrt-pow27.0%
metadata-eval7.0%
add-sqr-sqrt7.0%
add-sqr-sqrt7.0%
associate-+r+7.0%
sqrt-unprod7.0%
Applied egg-rr7.0%
Taylor expanded in x around inf 96.9%
*-commutative96.9%
Simplified96.9%
expm1-log1p-u96.9%
expm1-udef8.6%
inv-pow8.6%
sqrt-pow18.6%
metadata-eval8.6%
Applied egg-rr8.6%
expm1-def97.1%
expm1-log1p97.1%
Simplified97.1%
Final simplification97.9%
if x < 1Initial program 100.0%
flip--99.9%
div-inv99.9%
add-sqr-sqrt100.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
associate-*r/100.0%
*-rgt-identity100.0%
remove-double-neg100.0%
sub-neg100.0%
div-sub99.9%
rem-square-sqrt99.9%
sqr-neg99.9%
div-sub100.0%
sqr-neg100.0%
+-commutative100.0%
rem-square-sqrt100.0%
associate--l+100.0%
+-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
Simplified100.0%
add-sqr-sqrt99.9%
pow299.9%
pow1/299.9%
+-commutative99.9%
sqrt-pow199.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 97.7%
if 1 < x Initial program 8.3%
flip3--6.8%
div-inv6.8%
sqrt-pow26.7%
metadata-eval6.7%
sqrt-pow27.0%
metadata-eval7.0%
add-sqr-sqrt7.0%
add-sqr-sqrt7.0%
associate-+r+7.0%
sqrt-unprod7.0%
Applied egg-rr7.0%
Taylor expanded in x around inf 96.9%
*-commutative96.9%
Simplified96.9%
expm1-log1p-u96.9%
expm1-udef8.6%
inv-pow8.6%
sqrt-pow18.6%
metadata-eval8.6%
Applied egg-rr8.6%
expm1-def97.1%
expm1-log1p97.1%
Simplified97.1%
Final simplification97.4%
if x < 0.25Initial program 100.0%
Taylor expanded in x around 0 96.6%
if 0.25 < x Initial program 8.3%
flip3--6.8%
div-inv6.8%
sqrt-pow26.7%
metadata-eval6.7%
sqrt-pow27.0%
metadata-eval7.0%
add-sqr-sqrt7.0%
add-sqr-sqrt7.0%
associate-+r+7.0%
sqrt-unprod7.0%
Applied egg-rr7.0%
Taylor expanded in x around inf 96.9%
*-commutative96.9%
Simplified96.9%
expm1-log1p-u96.9%
expm1-udef8.6%
inv-pow8.6%
sqrt-pow18.6%
metadata-eval8.6%
Applied egg-rr8.6%
expm1-def97.1%
expm1-log1p97.1%
Simplified97.1%
Final simplification96.9%
Initial program 53.0%
Taylor expanded in x around 0 50.7%
Final simplification50.7%
herbie shell --seed 2023166
(FPCore (x)
:name "2sqrt (example 3.1)"
:precision binary64
:herbie-target
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(- (sqrt (+ x 1.0)) (sqrt x)))