
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))))) < +inf.0Initial program 99.9%
associate--l+99.9%
Simplified100.0%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))))) Initial program 0.0%
sub-neg0.0%
fma-def0.0%
fma-def3.2%
+-commutative3.2%
metadata-eval3.2%
Simplified3.2%
Taylor expanded in a around inf 95.3%
Final simplification98.9%
if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))))) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))))) Initial program 0.0%
sub-neg0.0%
fma-def0.0%
fma-def3.2%
+-commutative3.2%
metadata-eval3.2%
Simplified3.2%
Taylor expanded in a around inf 95.3%
Final simplification98.8%
if a < -1.12e30 or 6.2e12 < a Initial program 45.8%
sub-neg45.8%
fma-def45.8%
fma-def47.6%
+-commutative47.6%
metadata-eval47.6%
Simplified47.6%
Taylor expanded in a around inf 98.2%
if -1.12e30 < a < 6.2e12Initial program 97.9%
sub-neg97.9%
fma-def97.9%
fma-def97.9%
+-commutative97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in a around 0 84.2%
associate-+r+84.2%
associate-*r*84.2%
distribute-rgt-out94.4%
metadata-eval94.4%
distribute-lft-in94.4%
unpow294.4%
distribute-rgt-in94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in a around 0 96.4%
unpow296.4%
Simplified96.4%
Final simplification97.2%
if a < -1.4e22 or 5e8 < a Initial program 45.8%
sub-neg45.8%
fma-def45.8%
fma-def47.6%
+-commutative47.6%
metadata-eval47.6%
Simplified47.6%
Taylor expanded in a around inf 98.2%
if -1.4e22 < a < 5e8Initial program 97.9%
sub-neg97.9%
fma-def97.9%
fma-def97.9%
+-commutative97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in a around 0 84.2%
associate-+r+84.2%
associate-*r*84.2%
distribute-rgt-out94.4%
metadata-eval94.4%
distribute-lft-in94.4%
unpow294.4%
distribute-rgt-in94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in a around 0 96.4%
unpow296.4%
Simplified96.4%
+-commutative96.4%
metadata-eval96.4%
pow-prod-up96.3%
pow-prod-down96.3%
pow296.3%
distribute-rgt-out96.3%
Applied egg-rr96.3%
Final simplification97.1%
if a < -6.59999999999999989e153 or 6.59999999999999989e153 < a Initial program 27.7%
sub-neg27.7%
fma-def27.7%
fma-def27.7%
+-commutative27.7%
metadata-eval27.7%
Simplified27.7%
Taylor expanded in b around 0 43.1%
associate-*r*43.1%
unpow243.1%
Simplified43.1%
Taylor expanded in a around 0 100.0%
unpow2100.0%
Simplified100.0%
if -6.59999999999999989e153 < a < 6.59999999999999989e153Initial program 92.0%
sub-neg92.0%
fma-def92.0%
fma-def93.1%
+-commutative93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in a around 0 67.7%
associate-+r+67.7%
associate-*r*67.7%
distribute-rgt-out75.5%
metadata-eval75.5%
distribute-lft-in75.5%
unpow275.5%
distribute-rgt-in75.5%
metadata-eval75.5%
Simplified75.5%
Taylor expanded in a around 0 79.2%
unpow279.2%
Simplified79.2%
+-commutative79.2%
metadata-eval79.2%
pow-prod-up79.1%
pow-prod-down79.1%
pow279.1%
distribute-rgt-out79.2%
Applied egg-rr79.2%
Final simplification84.4%
if (*.f64 b b) < 2.0000000000000001e272Initial program 77.9%
sub-neg77.9%
fma-def77.9%
fma-def78.4%
+-commutative78.4%
metadata-eval78.4%
Simplified78.4%
Taylor expanded in b around 0 64.0%
associate-*r*64.0%
unpow264.0%
Simplified64.0%
Taylor expanded in a around 0 61.7%
unpow261.7%
Simplified61.7%
if 2.0000000000000001e272 < (*.f64 b b) Initial program 69.2%
sub-neg69.2%
fma-def69.2%
fma-def70.8%
+-commutative70.8%
metadata-eval70.8%
Simplified70.8%
Taylor expanded in a around 0 60.0%
associate-+r+60.0%
associate-*r*60.0%
distribute-rgt-out83.1%
metadata-eval83.1%
distribute-lft-in83.1%
unpow283.1%
distribute-rgt-in83.1%
metadata-eval83.1%
Simplified83.1%
Taylor expanded in a around 0 100.0%
unpow2100.0%
Simplified100.0%
+-commutative100.0%
metadata-eval100.0%
pow-prod-up100.0%
pow-prod-down100.0%
pow2100.0%
distribute-rgt-out100.0%
Applied egg-rr100.0%
Taylor expanded in b around 0 98.6%
unpow298.6%
*-commutative98.6%
associate-*r*98.6%
Simplified98.6%
Final simplification71.1%
Initial program 75.7%
sub-neg75.7%
fma-def75.7%
fma-def76.5%
+-commutative76.5%
metadata-eval76.5%
Simplified76.5%
Taylor expanded in b around 0 51.1%
associate-*r*51.1%
unpow251.1%
Simplified51.1%
Taylor expanded in a around 0 51.8%
unpow251.8%
Simplified51.8%
Final simplification51.8%
herbie shell --seed 2023166
(FPCore (a b)
:name "Bouland and Aaronson, Equation (24)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))