
Results
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 9.9999999999999995e-8 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 9.9999999999999995e-8Initial program 7.2%
sub0-neg7.2%
Simplified7.2%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
if im < -5.5000000000000001e114 or -4.9e20 < im < 0.029999999999999999 or 1.30000000000000003e102 < im Initial program 41.4%
sub0-neg41.4%
Simplified41.4%
Taylor expanded in im around 0 97.7%
mul-1-neg97.7%
unsub-neg97.7%
*-commutative97.7%
associate-*l*97.7%
distribute-lft-out--97.7%
Simplified97.7%
if -5.5000000000000001e114 < im < -4.9e20 or 0.029999999999999999 < im < 1.30000000000000003e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.6%
Final simplification95.7%
if im < -6.19999999999999982e113 or -0.070000000000000007 < im < 0.0820000000000000034 or 1.30000000000000003e102 < im Initial program 40.6%
sub0-neg40.6%
Simplified40.6%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
associate-*l*99.4%
distribute-lft-out--99.4%
Simplified99.4%
if -6.19999999999999982e113 < im < -0.070000000000000007Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out75.0%
+-commutative75.0%
*-commutative75.0%
unpow275.0%
associate-*l*75.0%
Simplified75.0%
if 0.0820000000000000034 < im < 1.30000000000000003e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 81.8%
Final simplification96.0%
if im < -5.99999999999999994e170 or 1.19999999999999997e102 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.7%
mul-1-neg98.7%
unsub-neg98.7%
*-commutative98.7%
associate-*l*98.7%
distribute-lft-out--98.7%
Simplified98.7%
Taylor expanded in re around 0 1.6%
associate--l+1.6%
associate-*r*1.6%
distribute-lft1-in75.0%
unpow275.0%
Simplified75.0%
if -5.99999999999999994e170 < im < -4.9e20 or 0.0071999999999999998 < im < 1.19999999999999997e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 84.3%
if -4.9e20 < im < 0.0071999999999999998Initial program 9.9%
sub0-neg9.9%
Simplified9.9%
Taylor expanded in im around 0 97.0%
mul-1-neg97.0%
*-commutative97.0%
distribute-lft-neg-in97.0%
Simplified97.0%
Final simplification88.9%
if im < -500 or 1.20000000000000007e35 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 72.8%
mul-1-neg72.8%
unsub-neg72.8%
*-commutative72.8%
associate-*l*72.8%
distribute-lft-out--72.8%
Simplified72.8%
Taylor expanded in re around 0 7.4%
associate--l+7.4%
associate-*r*7.4%
distribute-lft1-in61.0%
unpow261.0%
Simplified61.0%
if -500 < im < 1.20000000000000007e35Initial program 13.0%
sub0-neg13.0%
Simplified13.0%
Taylor expanded in im around 0 93.7%
mul-1-neg93.7%
*-commutative93.7%
distribute-lft-neg-in93.7%
Simplified93.7%
Final simplification79.7%
if im < -9.99999999999999949e60 or 5.7999999999999999e111 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 89.2%
mul-1-neg89.2%
unsub-neg89.2%
*-commutative89.2%
associate-*l*89.2%
distribute-lft-out--89.2%
Simplified89.2%
Taylor expanded in re around 0 57.7%
if -9.99999999999999949e60 < im < 1.20000000000000007e35Initial program 17.5%
sub0-neg17.5%
Simplified17.5%
Taylor expanded in im around 0 89.1%
mul-1-neg89.1%
*-commutative89.1%
distribute-lft-neg-in89.1%
Simplified89.1%
if 1.20000000000000007e35 < im < 5.7999999999999999e111Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 18.9%
mul-1-neg18.9%
unsub-neg18.9%
*-commutative18.9%
associate-*l*18.9%
distribute-lft-out--18.9%
Simplified18.9%
Taylor expanded in re around 0 27.7%
associate--l+27.7%
associate-*r*27.7%
distribute-lft1-in40.2%
unpow240.2%
Simplified40.2%
Taylor expanded in re around inf 38.1%
fma-neg38.1%
associate-*r*38.1%
unpow238.1%
fma-neg38.1%
Simplified38.1%
Taylor expanded in im around inf 38.1%
*-commutative38.1%
*-commutative38.1%
associate-*l*38.1%
unpow238.1%
Simplified38.1%
Final simplification75.4%
if im < -1.44999999999999992e62 or 3.1999999999999999e88 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.4%
mul-1-neg84.4%
unsub-neg84.4%
*-commutative84.4%
associate-*l*84.4%
distribute-lft-out--84.4%
Simplified84.4%
Taylor expanded in re around 0 53.3%
if -1.44999999999999992e62 < im < 9e14Initial program 13.6%
sub0-neg13.6%
Simplified13.6%
Taylor expanded in im around 0 93.1%
mul-1-neg93.1%
*-commutative93.1%
distribute-lft-neg-in93.1%
Simplified93.1%
if 9e14 < im < 3.1999999999999999e88Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out60.0%
+-commutative60.0%
*-commutative60.0%
unpow260.0%
associate-*l*60.0%
Simplified60.0%
Applied egg-rr33.9%
Taylor expanded in re around inf 34.4%
unpow234.4%
Simplified34.4%
Final simplification75.1%
if im < -360 or 2.3999999999999999e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
distribute-lft-neg-in5.6%
Simplified5.6%
Taylor expanded in re around 0 34.7%
neg-mul-134.7%
+-commutative34.7%
unsub-neg34.7%
*-commutative34.7%
*-commutative34.7%
associate-*l*34.7%
unpow234.7%
Simplified34.7%
if -360 < im < 2.3999999999999999e61Initial program 15.8%
sub0-neg15.8%
Simplified15.8%
Taylor expanded in im around 0 90.8%
mul-1-neg90.8%
*-commutative90.8%
distribute-lft-neg-in90.8%
Simplified90.8%
Final simplification67.8%
if im < -6.5e167 or -2.50000000000000009e61 < im < -620 or 1.20000000000000007e35 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 75.7%
mul-1-neg75.7%
unsub-neg75.7%
*-commutative75.7%
associate-*l*75.7%
distribute-lft-out--75.7%
Simplified75.7%
Taylor expanded in re around 0 8.1%
associate--l+8.1%
associate-*r*8.1%
distribute-lft1-in63.3%
unpow263.3%
Simplified63.3%
Taylor expanded in re around inf 39.3%
fma-neg39.3%
associate-*r*39.3%
unpow239.3%
fma-neg39.3%
Simplified39.3%
Taylor expanded in im around 0 38.4%
*-commutative38.4%
associate-*l*38.4%
unpow238.4%
Simplified38.4%
if -6.5e167 < im < -2.50000000000000009e61Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out68.0%
+-commutative68.0%
*-commutative68.0%
unpow268.0%
associate-*l*68.0%
Simplified68.0%
Applied egg-rr24.8%
Taylor expanded in re around inf 25.5%
*-commutative25.5%
unpow225.5%
associate-*l*25.5%
Simplified25.5%
if -620 < im < 1.20000000000000007e35Initial program 13.0%
sub0-neg13.0%
Simplified13.0%
Taylor expanded in im around 0 93.7%
mul-1-neg93.7%
*-commutative93.7%
distribute-lft-neg-in93.7%
Simplified93.7%
Taylor expanded in re around 0 48.9%
neg-mul-148.9%
Simplified48.9%
Final simplification43.1%
if im < -3.80000000000000007e166 or 1.2799999999999999e35 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.1%
mul-1-neg83.1%
unsub-neg83.1%
*-commutative83.1%
associate-*l*83.1%
distribute-lft-out--83.1%
Simplified83.1%
Taylor expanded in re around 0 5.8%
associate--l+5.8%
associate-*r*5.8%
distribute-lft1-in66.8%
unpow266.8%
Simplified66.8%
Taylor expanded in re around inf 40.4%
fma-neg40.4%
associate-*r*40.4%
unpow240.4%
fma-neg40.4%
Simplified40.4%
Taylor expanded in im around 0 39.5%
*-commutative39.5%
associate-*l*39.5%
unpow239.5%
Simplified39.5%
if -3.80000000000000007e166 < im < -7.59999999999999991e56Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out68.0%
+-commutative68.0%
*-commutative68.0%
unpow268.0%
associate-*l*68.0%
Simplified68.0%
Applied egg-rr24.8%
Taylor expanded in re around inf 25.5%
*-commutative25.5%
unpow225.5%
associate-*l*25.5%
Simplified25.5%
if -7.59999999999999991e56 < im < -225Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out100.0%
+-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Applied egg-rr28.7%
if -225 < im < 1.2799999999999999e35Initial program 13.0%
sub0-neg13.0%
Simplified13.0%
Taylor expanded in im around 0 93.7%
mul-1-neg93.7%
*-commutative93.7%
distribute-lft-neg-in93.7%
Simplified93.7%
Taylor expanded in re around 0 48.9%
neg-mul-148.9%
Simplified48.9%
Final simplification43.1%
if im < -9.1999999999999995e55 or 1.25e102 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out73.0%
+-commutative73.0%
*-commutative73.0%
unpow273.0%
associate-*l*73.0%
Simplified73.0%
Applied egg-rr25.0%
Taylor expanded in re around inf 24.9%
*-commutative24.9%
unpow224.9%
associate-*l*24.9%
Simplified24.9%
if -9.1999999999999995e55 < im < 8e12Initial program 13.6%
sub0-neg13.6%
Simplified13.6%
Taylor expanded in im around 0 93.1%
mul-1-neg93.1%
*-commutative93.1%
distribute-lft-neg-in93.1%
Simplified93.1%
Taylor expanded in re around 0 48.5%
neg-mul-148.5%
Simplified48.5%
if 8e12 < im < 1.25e102Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out60.0%
+-commutative60.0%
*-commutative60.0%
unpow260.0%
associate-*l*60.0%
Simplified60.0%
Applied egg-rr26.1%
Taylor expanded in re around inf 26.8%
unpow226.8%
Simplified26.8%
Final simplification38.6%
if im < -600 or 8e12 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out72.6%
+-commutative72.6%
*-commutative72.6%
unpow272.6%
associate-*l*72.6%
Simplified72.6%
Applied egg-rr17.8%
Taylor expanded in re around inf 17.7%
unpow217.7%
Simplified17.7%
if -600 < im < 8e12Initial program 8.6%
sub0-neg8.6%
Simplified8.6%
Taylor expanded in im around 0 98.3%
mul-1-neg98.3%
*-commutative98.3%
distribute-lft-neg-in98.3%
Simplified98.3%
Taylor expanded in re around 0 51.1%
neg-mul-151.1%
Simplified51.1%
Final simplification35.9%
Initial program 50.4%
sub0-neg50.4%
Simplified50.4%
Taylor expanded in im around 0 55.8%
mul-1-neg55.8%
*-commutative55.8%
distribute-lft-neg-in55.8%
Simplified55.8%
Taylor expanded in re around 0 39.1%
neg-mul-139.1%
+-commutative39.1%
unsub-neg39.1%
*-commutative39.1%
*-commutative39.1%
associate-*l*39.1%
unpow239.1%
Simplified39.1%
Final simplification39.1%
Initial program 50.4%
sub0-neg50.4%
Simplified50.4%
Taylor expanded in im around 0 55.8%
mul-1-neg55.8%
*-commutative55.8%
distribute-lft-neg-in55.8%
Simplified55.8%
Taylor expanded in re around 0 29.4%
neg-mul-129.4%
Simplified29.4%
Final simplification29.4%
Initial program 50.4%
sub0-neg50.4%
Simplified50.4%
Taylor expanded in re around 0 2.2%
*-commutative2.2%
associate-*r*2.2%
distribute-rgt-out36.2%
+-commutative36.2%
*-commutative36.2%
unpow236.2%
associate-*l*36.2%
Simplified36.2%
Applied egg-rr10.3%
Taylor expanded in re around 0 2.7%
Final simplification2.7%
Initial program 50.4%
sub0-neg50.4%
Simplified50.4%
Taylor expanded in re around 0 2.2%
*-commutative2.2%
associate-*r*2.2%
distribute-rgt-out36.2%
+-commutative36.2%
*-commutative36.2%
unpow236.2%
associate-*l*36.2%
Simplified36.2%
Applied egg-rr9.6%
Taylor expanded in re around 0 2.9%
Final simplification2.9%
herbie shell --seed 2023167
(FPCore (re im)
:name "math.sin on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (cos re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))