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-w32-3ac0c21a1fe902c7bebadc0fc454ee047e13c58f.tar.gz busybox-w32-3ac0c21a1fe902c7bebadc0fc454ee047e13c58f.tar.bz2 busybox-w32-3ac0c21a1fe902c7bebadc0fc454ee047e13c58f.zip | |
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 = { | |||
| 7161 | "\n" "r=x+1" | 7161 | "\n" "r=x+1" |
| 7162 | "\n" "p=x" | 7162 | "\n" "p=x" |
| 7163 | "\n" "f=v=1" | 7163 | "\n" "f=v=1" |
| 7164 | "\n" "for(i=2;v!=0;++i){" | 7164 | "\n" "for(i=2;v;++i){" |
| 7165 | "\n" "p*=x" | 7165 | "\n" "p*=x" |
| 7166 | "\n" "f*=i" | 7166 | "\n" "f*=i" |
| 7167 | "\n" "v=p/f" | 7167 | "\n" "v=p/f" |
| 7168 | "\n" "r+=v" | 7168 | "\n" "r+=v" |
| 7169 | "\n" "}" | 7169 | "\n" "}" |
| 7170 | "\n" "while((d--)!=0)r*=r" | 7170 | "\n" "while(d--)r*=r" |
| 7171 | "\n" "scale=s" | 7171 | "\n" "scale=s" |
| 7172 | "\n" "ibase=b" | 7172 | "\n" "ibase=b" |
| 7173 | "\n" "if(n!=0)return(1/r)" | 7173 | "\n" "if(n)return(1/r)" |
| 7174 | "\n" "return(r/1)" | 7174 | "\n" "return(r/1)" |
| 7175 | "\n" "}" | 7175 | "\n" "}" |
| 7176 | "\n" "define l(x){" | 7176 | "\n" "define l(x){" |
| @@ -7195,8 +7195,8 @@ static const char bc_lib[] ALIGN1 = { | |||
| 7195 | "\n" "}" | 7195 | "\n" "}" |
| 7196 | "\n" "r=a=(x-1)/(x+1)" | 7196 | "\n" "r=a=(x-1)/(x+1)" |
| 7197 | "\n" "q=a*a" | 7197 | "\n" "q=a*a" |
| 7198 | "\n" "v=1" | 7198 | "\n" "v=1" |
| 7199 | "\n" "for(i=3;v!=0;i+=2){" | 7199 | "\n" "for(i=3;v;i+=2){" |
| 7200 | "\n" "a*=q" | 7200 | "\n" "a*=q" |
| 7201 | "\n" "v=a/i" | 7201 | "\n" "v=a/i" |
| 7202 | "\n" "r+=v" | 7202 | "\n" "r+=v" |
| @@ -7220,17 +7220,17 @@ static const char bc_lib[] ALIGN1 = { | |||
| 7220 | "\n" "scale=0" | 7220 | "\n" "scale=0" |
| 7221 | "\n" "q=(x/a+2)/4" | 7221 | "\n" "q=(x/a+2)/4" |
| 7222 | "\n" "x=x-4*q*a" | 7222 | "\n" "x=x-4*q*a" |
| 7223 | "\n" "if(q%2!=0)x=-x" | 7223 | "\n" "if(q%2)x=-x" |
| 7224 | "\n" "scale=s+2" | 7224 | "\n" "scale=s+2" |
| 7225 | "\n" "r=a=x" | 7225 | "\n" "r=a=x" |
| 7226 | "\n" "q=-x*x" | 7226 | "\n" "q=-x*x" |
| 7227 | "\n" "for(i=3;a!=0;i+=2){" | 7227 | "\n" "for(i=3;a;i+=2){" |
| 7228 | "\n" "a*=q/(i*(i-1))" | 7228 | "\n" "a*=q/(i*(i-1))" |
| 7229 | "\n" "r+=a" | 7229 | "\n" "r+=a" |
| 7230 | "\n" "}" | 7230 | "\n" "}" |
| 7231 | "\n" "scale=s" | 7231 | "\n" "scale=s" |
| 7232 | "\n" "ibase=b" | 7232 | "\n" "ibase=b" |
| 7233 | "\n" "if(n!=0)return(-r/1)" | 7233 | "\n" "if(n)return(-r/1)" |
| 7234 | "\n" "return(r/1)" | 7234 | "\n" "return(r/1)" |
| 7235 | "\n" "}" | 7235 | "\n" "}" |
| 7236 | "\n" "define c(x){" | 7236 | "\n" "define c(x){" |
| @@ -7253,15 +7253,9 @@ static const char bc_lib[] ALIGN1 = { | |||
| 7253 | "\n" "n=-1" | 7253 | "\n" "n=-1" |
| 7254 | "\n" "x=-x" | 7254 | "\n" "x=-x" |
| 7255 | "\n" "}" | 7255 | "\n" "}" |
| 7256 | "\n" "if(x==1){" | 7256 | "\n" "if(scale<65){" |
| 7257 | "\n" "if(scale<65){" | 7257 | "\n" "if(x==1)return(.7853981633974483096156608458198757210492923498437764552437361480/n)" |
| 7258 | "\n" "return(.7853981633974483096156608458198757210492923498437764552437361480/n)" | 7258 | "\n" "if(x==.2)return(.1973955598498807583700497651947902934475851037878521015176889402/n)" |
| 7259 | "\n" "}" | ||
| 7260 | "\n" "}" | ||
| 7261 | "\n" "if(x==.2){" | ||
| 7262 | "\n" "if(scale<65){" | ||
| 7263 | "\n" "return(.1973955598498807583700497651947902934475851037878521015176889402/n)" | ||
| 7264 | "\n" "}" | ||
| 7265 | "\n" "}" | 7259 | "\n" "}" |
| 7266 | "\n" "s=scale" | 7260 | "\n" "s=scale" |
| 7267 | "\n" "if(x>.2){" | 7261 | "\n" "if(x>.2){" |
| @@ -7276,7 +7270,7 @@ static const char bc_lib[] ALIGN1 = { | |||
| 7276 | "\n" "r=u=x" | 7270 | "\n" "r=u=x" |
| 7277 | "\n" "f=-x*x" | 7271 | "\n" "f=-x*x" |
| 7278 | "\n" "t=1" | 7272 | "\n" "t=1" |
| 7279 | "\n" "for(i=3;t!=0;i+=2){" | 7273 | "\n" "for(i=3;t;i+=2){" |
| 7280 | "\n" "u*=f" | 7274 | "\n" "u*=f" |
| 7281 | "\n" "t=u/i" | 7275 | "\n" "t=u/i" |
| 7282 | "\n" "r+=t" | 7276 | "\n" "r+=t" |
| @@ -7303,13 +7297,13 @@ static const char bc_lib[] ALIGN1 = { | |||
| 7303 | "\n" "r=v=1" | 7297 | "\n" "r=v=1" |
| 7304 | "\n" "f=-x*x/4" | 7298 | "\n" "f=-x*x/4" |
| 7305 | "\n" "scale=scale+length(a)-scale(a)" | 7299 | "\n" "scale=scale+length(a)-scale(a)" |
| 7306 | "\n" "for(i=1;v!=0;++i){" | 7300 | "\n" "for(i=1;v;++i){" |
| 7307 | "\n" "v=v*f/i/(n+i)" | 7301 | "\n" "v=v*f/i/(n+i)" |
| 7308 | "\n" "r+=v" | 7302 | "\n" "r+=v" |
| 7309 | "\n" "}" | 7303 | "\n" "}" |
| 7310 | "\n" "scale=s" | 7304 | "\n" "scale=s" |
| 7311 | "\n" "ibase=b" | 7305 | "\n" "ibase=b" |
| 7312 | "\n" "if(o!=0)a=-a" | 7306 | "\n" "if(o)a=-a" |
| 7313 | "\n" "return(a*r/1)" | 7307 | "\n" "return(a*r/1)" |
| 7314 | "\n" "}" | 7308 | "\n" "}" |
| 7315 | }; | 7309 | }; |
