
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Initial program 75.8%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
expm1-log1p-u93.5%
expm1-udef93.4%
log1p-udef93.4%
add-exp-log99.7%
Applied egg-rr99.7%
associate--l+99.7%
fma-neg99.7%
metadata-eval99.7%
Simplified99.7%
sub-neg99.7%
associate--r+99.8%
metadata-eval99.8%
Applied egg-rr99.8%
sub-neg99.8%
sub0-neg99.8%
Simplified99.8%
Final simplification99.8%
if (tan.f64 a) < -1.99999999999999988e-11 or 5.0000000000000001e-9 < (tan.f64 a) Initial program 77.6%
tan-sum99.7%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
expm1-log1p-u91.4%
expm1-udef91.3%
log1p-udef91.3%
add-exp-log99.6%
Applied egg-rr99.6%
associate--l+99.7%
fma-neg99.7%
metadata-eval99.7%
Simplified99.7%
sub-neg99.7%
associate--r+99.7%
metadata-eval99.7%
Applied egg-rr99.7%
sub-neg99.7%
sub0-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 78.2%
if -1.99999999999999988e-11 < (tan.f64 a) < 5.0000000000000001e-9Initial program 73.9%
+-commutative73.9%
associate-+l-73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 73.9%
neg-mul-173.9%
Simplified73.9%
tan-sum99.8%
div-inv99.8%
Applied egg-rr99.3%
Final simplification88.4%
if (tan.f64 a) < -1.99999999999999988e-11 or 5.0000000000000001e-9 < (tan.f64 a) Initial program 77.6%
tan-sum99.7%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
expm1-log1p-u91.4%
expm1-udef91.3%
log1p-udef91.3%
add-exp-log99.6%
Applied egg-rr99.6%
associate--l+99.7%
fma-neg99.7%
metadata-eval99.7%
Simplified99.7%
sub-neg99.7%
associate--r+99.7%
metadata-eval99.7%
Applied egg-rr99.7%
sub-neg99.7%
sub0-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 78.2%
if -1.99999999999999988e-11 < (tan.f64 a) < 5.0000000000000001e-9Initial program 73.9%
+-commutative73.9%
associate-+l-73.9%
Applied egg-rr73.9%
Taylor expanded in a around 0 73.9%
neg-mul-173.9%
Simplified73.9%
sub-neg73.9%
Applied egg-rr73.9%
remove-double-neg73.9%
+-commutative73.9%
+-commutative73.9%
Simplified73.9%
tan-sum99.3%
+-commutative99.3%
Applied egg-rr99.3%
Final simplification88.4%
Initial program 75.8%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
Initial program 75.8%
tan-sum99.7%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
expm1-log1p-u93.5%
expm1-udef93.4%
log1p-udef93.4%
add-exp-log99.7%
Applied egg-rr99.7%
associate--l+99.7%
fma-neg99.7%
metadata-eval99.7%
Simplified99.7%
sub-neg99.7%
associate--r+99.8%
metadata-eval99.8%
Applied egg-rr99.8%
sub-neg99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 76.6%
Final simplification76.6%
if a < -14 or 7.99999999999999977e-28 < a Initial program 76.7%
+-commutative76.7%
sub-neg76.7%
associate-+l+76.6%
tan-quot76.6%
div-inv76.6%
fma-def76.6%
neg-mul-176.6%
fma-def76.6%
Applied egg-rr76.6%
fma-udef76.6%
associate-*r/76.6%
*-rgt-identity76.6%
+-commutative76.6%
+-commutative76.6%
fma-udef76.6%
neg-mul-176.6%
+-commutative76.6%
sub-neg76.6%
Simplified76.6%
Taylor expanded in y around 0 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in z around 0 44.0%
if -14 < a < 7.99999999999999977e-28Initial program 74.9%
+-commutative74.9%
associate-+l-74.9%
Applied egg-rr74.9%
Taylor expanded in a around 0 74.8%
neg-mul-174.8%
unsub-neg74.8%
Simplified74.8%
Final simplification59.0%
if (+.f64 y z) < -1.99999999999999996e-12Initial program 70.0%
+-commutative70.0%
associate-+l-69.9%
Applied egg-rr69.9%
Taylor expanded in a around 0 44.2%
neg-mul-144.2%
Simplified44.2%
sub-neg44.2%
Applied egg-rr44.2%
remove-double-neg44.2%
+-commutative44.2%
+-commutative44.2%
Simplified44.2%
if -1.99999999999999996e-12 < (+.f64 y z) Initial program 79.5%
add-sqr-sqrt74.0%
sqrt-unprod74.7%
pow274.7%
associate-+r-74.7%
+-commutative74.7%
associate--l+74.7%
Applied egg-rr74.7%
Taylor expanded in y around 0 60.9%
sqrt-pow164.7%
metadata-eval64.7%
pow164.7%
tan-quot64.7%
+-commutative64.7%
Applied egg-rr64.7%
Final simplification56.8%
if y < -2.39999999999999987e-12Initial program 57.0%
+-commutative57.0%
associate-+l-56.9%
Applied egg-rr56.9%
Taylor expanded in a around 0 38.3%
neg-mul-138.3%
Simplified38.3%
Taylor expanded in z around 0 38.4%
if -2.39999999999999987e-12 < y Initial program 82.9%
add-sqr-sqrt77.1%
sqrt-unprod77.8%
pow277.8%
associate-+r-77.8%
+-commutative77.8%
associate--l+77.8%
Applied egg-rr77.8%
Taylor expanded in y around 0 66.1%
sqrt-pow170.4%
metadata-eval70.4%
pow170.4%
tan-quot70.4%
+-commutative70.4%
Applied egg-rr70.4%
Final simplification61.6%
Initial program 75.8%
Final simplification75.8%
if a < -0.048000000000000001 or 7.99999999999999977e-28 < a Initial program 76.3%
associate-+r-76.1%
Simplified76.1%
flip-+76.0%
clear-num75.9%
pow275.9%
Applied egg-rr75.9%
Taylor expanded in x around inf 43.6%
if -0.048000000000000001 < a < 7.99999999999999977e-28Initial program 75.4%
+-commutative75.4%
associate-+l-75.3%
Applied egg-rr75.3%
Taylor expanded in a around 0 75.2%
neg-mul-175.2%
unsub-neg75.2%
Simplified75.2%
Final simplification58.9%
Initial program 75.8%
+-commutative75.8%
associate-+l-75.8%
Applied egg-rr75.8%
Taylor expanded in a around 0 47.9%
neg-mul-147.9%
Simplified47.9%
sub-neg47.9%
Applied egg-rr47.9%
remove-double-neg47.9%
+-commutative47.9%
+-commutative47.9%
Simplified47.9%
Final simplification47.9%
Initial program 75.8%
Taylor expanded in x around inf 29.1%
Final simplification29.1%
herbie shell --seed 2023167
(FPCore (x y z a)
:name "tan-example (used to crash)"
:precision binary64
:pre (and (and (and (or (== x 0.0) (and (<= 0.5884142 x) (<= x 505.5909))) (or (and (<= -1.796658e+308 y) (<= y -9.425585e-310)) (and (<= 1.284938e-309 y) (<= y 1.751224e+308)))) (or (and (<= -1.776707e+308 z) (<= z -8.599796e-310)) (and (<= 3.293145e-311 z) (<= z 1.725154e+308)))) (or (and (<= -1.796658e+308 a) (<= a -9.425585e-310)) (and (<= 1.284938e-309 a) (<= a 1.751224e+308))))
(+ x (- (tan (+ y z)) (tan a))))