
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 71.3%
times-frac71.3%
fma-def71.3%
associate-/r*71.3%
difference-of-squares71.3%
Simplified74.5%
Taylor expanded in c0 around inf 77.8%
associate-*r/77.8%
unpow277.8%
unpow277.8%
Simplified77.8%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 53.0%
Taylor expanded in c0 around -inf 57.6%
fma-def57.6%
times-frac57.6%
unpow257.6%
unpow257.6%
*-commutative57.6%
unpow257.6%
associate-*r*57.6%
Simplified64.1%
associate-*l/64.0%
times-frac64.4%
associate-/l*64.4%
mul0-rgt64.4%
*-commutative64.4%
Applied egg-rr64.4%
associate-*l/70.4%
*-commutative70.4%
fma-udef70.4%
+-rgt-identity70.4%
associate-*r/70.2%
Simplified70.2%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 79.5%
times-frac74.2%
fma-def74.1%
associate-/r*74.1%
difference-of-squares74.1%
Simplified76.8%
Taylor expanded in h around 0 19.0%
fma-def19.0%
Simplified84.8%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
Taylor expanded in c0 around -inf 3.0%
fma-def3.0%
times-frac4.3%
unpow24.3%
unpow24.3%
*-commutative4.3%
unpow24.3%
associate-*r*4.3%
Simplified31.3%
associate-*l/36.1%
times-frac47.8%
associate-/l*47.3%
mul0-rgt47.3%
*-commutative47.3%
Applied egg-rr47.3%
Final simplification57.9%
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -2e-247Initial program 69.3%
times-frac69.2%
fma-def69.2%
associate-/r*69.2%
difference-of-squares69.2%
Simplified72.3%
associate-*l/80.4%
Applied egg-rr83.5%
unpow283.5%
times-frac77.3%
associate-/r*80.6%
associate-*r/80.6%
associate-/l*83.6%
Applied egg-rr83.6%
if -2e-247 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 72.9%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
Taylor expanded in c0 around -inf 3.0%
fma-def3.0%
times-frac4.3%
unpow24.3%
unpow24.3%
*-commutative4.3%
unpow24.3%
associate-*r*4.3%
Simplified31.3%
associate-*l/36.1%
times-frac47.8%
associate-/l*47.3%
mul0-rgt47.3%
*-commutative47.3%
Applied egg-rr47.3%
Final simplification57.0%
if (*.f64 M M) < 6.49999999999999977e-128Initial program 25.6%
Taylor expanded in c0 around -inf 7.7%
fma-def7.7%
times-frac7.7%
unpow27.7%
unpow27.7%
*-commutative7.7%
unpow27.7%
associate-*r*7.7%
Simplified32.4%
associate-*l/36.9%
times-frac43.7%
associate-/l*43.0%
mul0-rgt43.0%
*-commutative43.0%
Applied egg-rr43.0%
if 6.49999999999999977e-128 < (*.f64 M M) < 2.5999999999999999e-34Initial program 56.7%
times-frac50.5%
fma-def50.4%
associate-/r*50.5%
difference-of-squares50.5%
Simplified50.5%
Taylor expanded in c0 around inf 62.9%
associate-*r/62.9%
unpow262.9%
unpow262.9%
Simplified62.9%
if 2.5999999999999999e-34 < (*.f64 M M) < 1.0499999999999999e48Initial program 0.1%
Taylor expanded in c0 around -inf 7.9%
fma-def7.9%
times-frac0.2%
unpow20.2%
unpow20.2%
*-commutative0.2%
unpow20.2%
associate-*r*0.2%
Simplified38.7%
Taylor expanded in c0 around 0 81.7%
associate-/l*81.6%
*-commutative81.6%
unpow281.6%
unpow281.6%
*-commutative81.6%
unpow281.6%
Simplified81.6%
if 1.0499999999999999e48 < (*.f64 M M) < 9.4999999999999994e140 or 2.30000000000000004e223 < (*.f64 M M) Initial program 19.2%
times-frac19.1%
fma-def19.1%
associate-/r*19.1%
difference-of-squares50.2%
Simplified54.3%
fma-udef54.3%
associate-/l/50.3%
frac-times55.7%
pow255.7%
Applied egg-rr55.7%
Taylor expanded in c0 around inf 52.4%
associate-*r/52.4%
unpow252.4%
associate-*l*55.2%
unpow255.2%
Simplified55.2%
if 9.4999999999999994e140 < (*.f64 M M) < 2.30000000000000004e223Initial program 11.8%
Taylor expanded in c0 around -inf 0.0%
fma-def0.0%
times-frac0.0%
unpow20.0%
unpow20.0%
*-commutative0.0%
unpow20.0%
associate-*r*0.0%
Simplified12.6%
associate-*r/24.3%
times-frac53.0%
Applied egg-rr53.0%
Final simplification50.4%
if (*.f64 M M) < 4.30000000000000029e-130Initial program 25.6%
Taylor expanded in c0 around -inf 7.7%
fma-def7.7%
times-frac7.7%
unpow27.7%
unpow27.7%
*-commutative7.7%
unpow27.7%
associate-*r*7.7%
Simplified32.4%
associate-*l/36.9%
times-frac43.7%
associate-/l*43.0%
mul0-rgt43.0%
*-commutative43.0%
Applied egg-rr43.0%
if 4.30000000000000029e-130 < (*.f64 M M) < 3.3499999999999999e-21Initial program 56.7%
times-frac50.5%
fma-def50.4%
associate-/r*50.5%
difference-of-squares50.5%
Simplified50.5%
Taylor expanded in c0 around inf 62.9%
associate-*r/62.9%
unpow262.9%
unpow262.9%
Simplified62.9%
if 3.3499999999999999e-21 < (*.f64 M M) < 3.3e50Initial program 0.1%
Taylor expanded in c0 around -inf 7.9%
fma-def7.9%
times-frac0.2%
unpow20.2%
unpow20.2%
*-commutative0.2%
unpow20.2%
associate-*r*0.2%
Simplified38.7%
Taylor expanded in c0 around 0 81.7%
associate-/l*81.6%
*-commutative81.6%
unpow281.6%
unpow281.6%
*-commutative81.6%
unpow281.6%
Simplified81.6%
if 3.3e50 < (*.f64 M M) < 2.70000000000000018e140 or 4.40000000000000019e298 < (*.f64 M M) Initial program 12.3%
times-frac12.2%
fma-def12.2%
associate-/r*12.2%
difference-of-squares51.9%
Simplified52.0%
fma-udef52.0%
associate-/l/52.0%
frac-times53.7%
pow253.7%
Applied egg-rr53.7%
Taylor expanded in c0 around inf 54.5%
associate-*r/54.5%
unpow254.5%
associate-*l*56.4%
unpow256.4%
Simplified56.4%
if 2.70000000000000018e140 < (*.f64 M M) < 6.5000000000000006e225Initial program 11.8%
Taylor expanded in c0 around -inf 0.0%
fma-def0.0%
times-frac0.0%
unpow20.0%
unpow20.0%
*-commutative0.0%
unpow20.0%
associate-*r*0.0%
Simplified12.6%
associate-*l/13.3%
times-frac42.1%
associate-/l*42.1%
mul0-rgt42.1%
*-commutative42.1%
Applied egg-rr42.1%
associate-*l/41.2%
*-commutative41.2%
fma-udef41.2%
+-rgt-identity41.2%
associate-*r/47.0%
Simplified47.0%
if 6.5000000000000006e225 < (*.f64 M M) < 4.40000000000000019e298Initial program 44.2%
times-frac44.2%
fma-def44.2%
associate-/r*44.2%
difference-of-squares44.2%
Simplified62.9%
Taylor expanded in c0 around inf 38.3%
times-frac38.3%
unpow238.3%
unpow238.3%
unpow238.3%
*-commutative38.3%
unpow238.3%
Simplified38.3%
times-frac67.0%
Applied egg-rr67.0%
Final simplification51.0%
if (*.f64 d d) < 4.9999999999999998e-70Initial program 19.3%
times-frac15.8%
fma-def15.7%
associate-/r*15.8%
difference-of-squares22.5%
Simplified34.6%
Taylor expanded in c0 around inf 24.5%
times-frac24.5%
unpow224.5%
unpow224.5%
unpow224.5%
*-commutative24.5%
unpow224.5%
Simplified24.5%
times-frac48.9%
Applied egg-rr48.9%
if 4.9999999999999998e-70 < (*.f64 d d) < 5.00000000000000008e99 or 4.99999999999999973e182 < (*.f64 d d) < 1e220 or 1.0000000000000001e230 < (*.f64 d d) < 4.9999999999999996e292Initial program 17.0%
Taylor expanded in c0 around -inf 13.5%
fma-def13.5%
times-frac15.1%
unpow215.1%
unpow215.1%
*-commutative15.1%
unpow215.1%
associate-*r*15.1%
Simplified46.0%
Taylor expanded in c0 around 0 66.1%
associate-/l*66.1%
*-commutative66.1%
unpow266.1%
unpow266.1%
*-commutative66.1%
unpow266.1%
Simplified66.1%
if 5.00000000000000008e99 < (*.f64 d d) < 4.99999999999999973e182 or 4.9999999999999996e292 < (*.f64 d d) Initial program 28.3%
times-frac27.5%
fma-def27.5%
associate-/r*27.5%
difference-of-squares36.9%
Simplified39.5%
fma-udef39.5%
associate-/l/36.1%
frac-times39.5%
pow239.5%
Applied egg-rr39.5%
Taylor expanded in c0 around inf 38.3%
associate-*r/38.3%
unpow238.3%
associate-*l*42.3%
unpow242.3%
Simplified42.3%
if 1e220 < (*.f64 d d) < 1.0000000000000001e230Initial program 28.6%
times-frac28.6%
fma-def28.6%
associate-/r*28.6%
difference-of-squares71.4%
Simplified71.4%
Taylor expanded in c0 around inf 71.7%
times-frac71.7%
unpow271.7%
unpow271.7%
unpow271.7%
*-commutative71.7%
unpow271.7%
Simplified71.7%
associate-*l/71.7%
times-frac71.7%
Applied egg-rr71.7%
unpow271.7%
times-frac71.9%
unpow271.9%
unpow271.9%
associate-*r/71.9%
unpow271.9%
Simplified71.9%
Final simplification50.4%
if c0 < -5.50000000000000005e-38 or 4.80000000000000007e-121 < c0 Initial program 27.0%
times-frac26.4%
fma-def25.3%
associate-/r*25.3%
difference-of-squares36.2%
Simplified41.3%
Taylor expanded in c0 around inf 32.3%
times-frac31.8%
unpow231.8%
unpow231.8%
unpow231.8%
*-commutative31.8%
unpow231.8%
Simplified31.8%
times-frac42.8%
Applied egg-rr42.8%
if -5.50000000000000005e-38 < c0 < 4.80000000000000007e-121Initial program 14.5%
times-frac10.5%
fma-def10.4%
associate-/r*10.4%
difference-of-squares14.6%
Simplified20.3%
Taylor expanded in c0 around -inf 5.9%
associate-*r*5.9%
distribute-rgt1-in5.9%
metadata-eval5.9%
mul0-lft47.8%
metadata-eval47.8%
mul0-lft7.4%
metadata-eval7.4%
distribute-lft1-in7.4%
*-commutative7.4%
distribute-lft1-in7.4%
metadata-eval7.4%
mul0-lft47.8%
Simplified47.8%
Final simplification44.2%
if w < -2.1999999999999999e47Initial program 13.1%
times-frac11.1%
fma-def11.1%
associate-/r*11.1%
difference-of-squares17.4%
Simplified24.1%
Taylor expanded in c0 around -inf 9.2%
associate-*r*9.2%
distribute-rgt1-in9.2%
metadata-eval9.2%
mul0-lft42.5%
metadata-eval42.5%
mul0-lft9.1%
metadata-eval9.1%
distribute-lft1-in9.1%
*-commutative9.1%
distribute-lft1-in9.1%
metadata-eval9.1%
mul0-lft42.5%
Simplified42.5%
if -2.1999999999999999e47 < w Initial program 25.8%
Taylor expanded in c0 around -inf 6.0%
fma-def6.0%
times-frac6.5%
unpow26.5%
unpow26.5%
*-commutative6.5%
unpow26.5%
associate-*r*6.5%
Simplified24.7%
Taylor expanded in c0 around 0 35.6%
associate-/l*35.2%
*-commutative35.2%
unpow235.2%
unpow235.2%
*-commutative35.2%
unpow235.2%
Simplified35.2%
Final simplification36.5%
Initial program 23.5%
times-frac21.9%
fma-def21.1%
associate-/r*21.1%
difference-of-squares30.1%
Simplified35.4%
Taylor expanded in c0 around -inf 4.4%
associate-*r*4.4%
distribute-rgt1-in4.4%
metadata-eval4.4%
mul0-lft26.6%
metadata-eval26.6%
mul0-lft5.5%
metadata-eval5.5%
distribute-lft1-in5.5%
*-commutative5.5%
distribute-lft1-in5.5%
metadata-eval5.5%
mul0-lft26.6%
Simplified26.6%
Final simplification26.6%
herbie shell --seed 2023166
(FPCore (c0 w h D d M)
:name "Henrywood and Agarwal, Equation (13)"
:precision binary64
(* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))