diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-14 01:01:01 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-14 01:01:01 +0100 |
commit | 3ac0c21a1fe902c7bebadc0fc454ee047e13c58f (patch) | |
tree | d0e32b157aea67d02ff496485df9eb24e5b5a03e /miscutils | |
parent | 57b6918b0a12e52207709070d0712910cb4323b9 (diff) | |
download | busybox-3ac0c21a1fe902c7bebadc0fc454ee047e13c58f.tar.gz |
bc: shrink internal library
function old new delta
bc_lib 1674 1618 -56
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/bc.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index a572ad30a..0a2da6cf8 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -7161,16 +7161,16 @@ static const char bc_lib[] ALIGN1 = { "\n" "r=x+1" "\n" "p=x" "\n" "f=v=1" -"\n" "for(i=2;v!=0;++i){" +"\n" "for(i=2;v;++i){" "\n" "p*=x" "\n" "f*=i" "\n" "v=p/f" "\n" "r+=v" "\n" "}" -"\n" "while((d--)!=0)r*=r" +"\n" "while(d--)r*=r" "\n" "scale=s" "\n" "ibase=b" -"\n" "if(n!=0)return(1/r)" +"\n" "if(n)return(1/r)" "\n" "return(r/1)" "\n" "}" "\n" "define l(x){" @@ -7195,8 +7195,8 @@ static const char bc_lib[] ALIGN1 = { "\n" "}" "\n" "r=a=(x-1)/(x+1)" "\n" "q=a*a" -"\n" "v=1" -"\n" "for(i=3;v!=0;i+=2){" +"\n" "v=1" +"\n" "for(i=3;v;i+=2){" "\n" "a*=q" "\n" "v=a/i" "\n" "r+=v" @@ -7220,17 +7220,17 @@ static const char bc_lib[] ALIGN1 = { "\n" "scale=0" "\n" "q=(x/a+2)/4" "\n" "x=x-4*q*a" -"\n" "if(q%2!=0)x=-x" +"\n" "if(q%2)x=-x" "\n" "scale=s+2" "\n" "r=a=x" "\n" "q=-x*x" -"\n" "for(i=3;a!=0;i+=2){" +"\n" "for(i=3;a;i+=2){" "\n" "a*=q/(i*(i-1))" "\n" "r+=a" "\n" "}" "\n" "scale=s" "\n" "ibase=b" -"\n" "if(n!=0)return(-r/1)" +"\n" "if(n)return(-r/1)" "\n" "return(r/1)" "\n" "}" "\n" "define c(x){" @@ -7253,15 +7253,9 @@ static const char bc_lib[] ALIGN1 = { "\n" "n=-1" "\n" "x=-x" "\n" "}" -"\n" "if(x==1){" -"\n" "if(scale<65){" -"\n" "return(.7853981633974483096156608458198757210492923498437764552437361480/n)" -"\n" "}" -"\n" "}" -"\n" "if(x==.2){" -"\n" "if(scale<65){" -"\n" "return(.1973955598498807583700497651947902934475851037878521015176889402/n)" -"\n" "}" +"\n" "if(scale<65){" +"\n" "if(x==1)return(.7853981633974483096156608458198757210492923498437764552437361480/n)" +"\n" "if(x==.2)return(.1973955598498807583700497651947902934475851037878521015176889402/n)" "\n" "}" "\n" "s=scale" "\n" "if(x>.2){" @@ -7276,7 +7270,7 @@ static const char bc_lib[] ALIGN1 = { "\n" "r=u=x" "\n" "f=-x*x" "\n" "t=1" -"\n" "for(i=3;t!=0;i+=2){" +"\n" "for(i=3;t;i+=2){" "\n" "u*=f" "\n" "t=u/i" "\n" "r+=t" @@ -7303,13 +7297,13 @@ static const char bc_lib[] ALIGN1 = { "\n" "r=v=1" "\n" "f=-x*x/4" "\n" "scale=scale+length(a)-scale(a)" -"\n" "for(i=1;v!=0;++i){" +"\n" "for(i=1;v;++i){" "\n" "v=v*f/i/(n+i)" "\n" "r+=v" "\n" "}" "\n" "scale=s" "\n" "ibase=b" -"\n" "if(o!=0)a=-a" +"\n" "if(o)a=-a" "\n" "return(a*r/1)" "\n" "}" }; |