Changeset d694de in git for Singular/LIB/general.lib
- Timestamp:
- Jun 18, 1999, 3:47:27 PM (24 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 092430050dbf6ad127e0cf157b408a5b79bf6403
- Parents:
- 96badc17f8c673319c806aa0ade02ab8ab717e4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
r96badc rd694de 1 // $Id: general.lib,v 1.1 1 1999-06-07 17:25:07 SingularExp $1 // $Id: general.lib,v 1.12 1999-06-18 13:47:27 greuel Exp $ 2 2 //system("random",787422842); 3 //GMG, last modified 30.9.984 /////////////////////////////////////////////////////////////////////////////// 5 6 version="$Id: general.lib,v 1.1 1 1999-06-07 17:25:07 SingularExp $";3 //GMG, last modified 18.6.99 4 /////////////////////////////////////////////////////////////////////////////// 5 6 version="$Id: general.lib,v 1.12 1999-06-18 13:47:27 greuel Exp $"; 7 7 info=" 8 8 LIBRARY: general.lib PROCEDURES OF GENERAL TYPE … … 13 13 factorial(n[,../..]); n factorial (=n!) (type int), [type string/number] 14 14 fibonacci(n[,p]); nth Fibonacci number [char p] 15 kmemory( ); int = active memory (kilobyte)15 kmemory([n]); active [allocated] memory in kilobyte 16 16 killall(); kill all user-defined variables 17 17 number_e(n); compute exp(1) up to n decimal digits … … 230 230 /////////////////////////////////////////////////////////////////////////////// 231 231 232 proc kmemory () 233 "USAGE: kmemory(); 234 RETURN: memory used by active variables, of type int (in kilobyte) 232 proc kmemory (list #) 233 "USAGE: kmemory([n]); n = int 234 RETURN: memory in kilobyte of type int 235 n=0: memory used by active variables (same as no parameters) 236 n=1: total memory allocated by Singular 237 n=2: difference between top and init memory adress (sbrk memory) 238 n!=0,1,2: 0 239 DISPLAY: detailed information about allocated and used memory if n!=0,1,2 240 NOTE: kmemory uses internal function 'memory' to compute kilobyte, and 241 is the same as 'memory' for n!=0,1,2 235 242 EXAMPLE: example kmemory; shows an example 236 243 " 237 { 238 if ( voice==2 ) { "// memory used by active variables (kilobyte):"; } 239 return ((memory(0)+1023)/1024); 244 { 245 int n; 246 if (size(#) != 0) 247 { 248 n=#[1]; 249 } 250 251 if ( n==0) 252 { dbprint(printlevel-voice+3, 253 "// memory used, at the moment, by active variables (kilobyte):"); } 254 if ( n==1 ) 255 { dbprint(printlevel-voice+3, 256 "// total memory allocated, at the moment, by SINGULAR (kilobyte):"); } 257 return ((memory(n)+1023)/1024); 240 258 } 241 259 example 242 260 { "EXAMPLE:"; echo = 2; 243 261 kmemory(); 262 kmemory(1); 244 263 } 245 264 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.