
Results
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if re < 2.6999999999999997e27Initial program 48.2%
hypot-def92.6%
Simplified92.6%
if 2.6999999999999997e27 < re Initial program 6.7%
Taylor expanded in re around inf 52.7%
unpow252.7%
Simplified52.7%
Taylor expanded in im around 0 83.2%
*-commutative83.2%
unpow1/283.2%
unpow-183.2%
exp-to-pow78.0%
*-commutative78.0%
neg-mul-178.0%
exp-prod78.0%
distribute-lft-neg-out78.0%
distribute-rgt-neg-in78.0%
metadata-eval78.0%
exp-to-pow83.2%
Simplified83.2%
Final simplification90.6%
if re < -2.19999999999999987e68Initial program 24.6%
Taylor expanded in re around -inf 81.4%
*-commutative81.4%
Simplified81.4%
if -2.19999999999999987e68 < re < 6.1000000000000001e-33Initial program 60.1%
Taylor expanded in re around 0 80.5%
if 6.1000000000000001e-33 < re < 2.8e12Initial program 14.0%
Taylor expanded in re around inf 43.4%
unpow243.4%
Simplified43.4%
expm1-log1p-u43.4%
expm1-udef5.0%
associate-*r*5.0%
metadata-eval5.0%
*-un-lft-identity5.0%
sqrt-div5.0%
sqrt-prod5.3%
add-sqr-sqrt5.3%
Applied egg-rr5.3%
expm1-def72.1%
expm1-log1p72.1%
Simplified72.1%
if 2.8e12 < re < 1.2200000000000001e27Initial program 4.1%
*-commutative4.1%
hypot-udef100.0%
*-commutative100.0%
add-sqr-sqrt99.1%
pow299.1%
pow1/299.1%
sqrt-pow199.1%
metadata-eval99.1%
Applied egg-rr99.1%
Taylor expanded in re around 0 99.1%
Taylor expanded in im around 0 89.9%
log-prod89.9%
*-commutative89.9%
exp-to-pow99.1%
unpow299.1%
pow-sqr100.0%
metadata-eval100.0%
unpow1/2100.0%
Simplified100.0%
if 1.2200000000000001e27 < re Initial program 6.7%
Taylor expanded in re around inf 52.7%
unpow252.7%
Simplified52.7%
Taylor expanded in im around 0 83.2%
*-commutative83.2%
unpow1/283.2%
unpow-183.2%
exp-to-pow78.0%
*-commutative78.0%
neg-mul-178.0%
exp-prod78.0%
distribute-lft-neg-out78.0%
distribute-rgt-neg-in78.0%
metadata-eval78.0%
exp-to-pow83.2%
Simplified83.2%
Final simplification81.3%
if re < -3.69999999999999998e68Initial program 24.6%
Taylor expanded in re around -inf 81.4%
*-commutative81.4%
Simplified81.4%
if -3.69999999999999998e68 < re < 3.69999999999999988e26Initial program 55.4%
*-commutative55.4%
hypot-udef90.4%
*-commutative90.4%
add-sqr-sqrt89.7%
pow289.7%
pow1/289.7%
sqrt-pow189.7%
metadata-eval89.7%
Applied egg-rr89.7%
Taylor expanded in re around 0 75.8%
Taylor expanded in im around 0 70.7%
log-prod71.0%
*-commutative71.0%
exp-to-pow75.8%
unpow275.8%
pow-sqr76.4%
metadata-eval76.4%
unpow1/276.4%
Simplified76.4%
if 3.69999999999999988e26 < re Initial program 6.7%
Taylor expanded in re around inf 52.7%
unpow252.7%
Simplified52.7%
Taylor expanded in im around 0 83.2%
*-commutative83.2%
unpow1/283.2%
unpow-183.2%
exp-to-pow78.0%
*-commutative78.0%
neg-mul-178.0%
exp-prod78.0%
distribute-lft-neg-out78.0%
distribute-rgt-neg-in78.0%
metadata-eval78.0%
exp-to-pow83.2%
Simplified83.2%
Final simplification78.8%
if re < 1.19999999999999999e27Initial program 48.2%
*-commutative48.2%
hypot-udef92.6%
*-commutative92.6%
add-sqr-sqrt91.9%
pow291.9%
pow1/291.9%
sqrt-pow191.9%
metadata-eval91.9%
Applied egg-rr91.9%
Taylor expanded in re around 0 63.7%
Taylor expanded in im around 0 59.4%
log-prod59.7%
*-commutative59.7%
exp-to-pow63.7%
unpow263.7%
pow-sqr64.1%
metadata-eval64.1%
unpow1/264.1%
Simplified64.1%
if 1.19999999999999999e27 < re Initial program 6.7%
Taylor expanded in re around inf 52.7%
unpow252.7%
Simplified52.7%
Taylor expanded in im around 0 83.2%
*-commutative83.2%
unpow1/283.2%
unpow-183.2%
exp-to-pow78.0%
*-commutative78.0%
neg-mul-178.0%
exp-prod78.0%
distribute-lft-neg-out78.0%
distribute-rgt-neg-in78.0%
metadata-eval78.0%
exp-to-pow83.2%
Simplified83.2%
Final simplification68.1%
if re < 6.2000000000000001e28Initial program 48.2%
*-commutative48.2%
hypot-udef92.6%
*-commutative92.6%
add-sqr-sqrt91.9%
pow291.9%
pow1/291.9%
sqrt-pow191.9%
metadata-eval91.9%
Applied egg-rr91.9%
Taylor expanded in re around 0 63.7%
Taylor expanded in im around 0 59.4%
log-prod59.7%
*-commutative59.7%
exp-to-pow63.7%
unpow263.7%
pow-sqr64.1%
metadata-eval64.1%
unpow1/264.1%
Simplified64.1%
if 6.2000000000000001e28 < re Initial program 6.7%
Taylor expanded in re around inf 52.7%
unpow252.7%
Simplified52.7%
expm1-log1p-u52.7%
expm1-udef26.4%
associate-*r*26.4%
metadata-eval26.4%
*-un-lft-identity26.4%
sqrt-div26.4%
sqrt-prod35.6%
add-sqr-sqrt35.6%
Applied egg-rr35.6%
expm1-def82.3%
expm1-log1p83.1%
Simplified83.1%
Final simplification68.1%
Initial program 39.4%
*-commutative39.4%
hypot-udef81.6%
*-commutative81.6%
add-sqr-sqrt81.0%
pow281.0%
pow1/281.0%
sqrt-pow181.0%
metadata-eval81.0%
Applied egg-rr81.0%
Taylor expanded in re around 0 54.6%
Taylor expanded in im around 0 50.9%
log-prod51.2%
*-commutative51.2%
exp-to-pow54.6%
unpow254.6%
pow-sqr55.0%
metadata-eval55.0%
unpow1/255.0%
Simplified55.0%
Final simplification55.0%
herbie shell --seed 2023166
(FPCore (re im)
:name "math.sqrt on complex, imaginary part, im greater than 0 branch"
:precision binary64
:pre (> im 0.0)
(* 0.5 (sqrt (* 2.0 (- (sqrt (+ (* re re) (* im im))) re)))))