source: git/ntl/doc/tools.txt @ 2cfffe

spielwiese
Last change on this file since 2cfffe was 2cfffe, checked in by Hans Schönemann <hannes@…>, 21 years ago
This commit was generated by cvs2svn to compensate for changes in r6316, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6317 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.5 KB
Line 
1
2/**************************************************************************\
3
4MODULE: tools
5
6SUMMARY:
7
8Some useful tools that are used throughout NTL.
9
10\**************************************************************************/
11
12
13#include <NTL/config.h>
14
15#include <stdlib.h>
16#include <math.h>
17#include <iostream.h>
18
19
20double GetTime();
21// returns number of seconds of CPU time used by this process;
22
23void PrintTime(ostream& s, double t);
24// prints the time t (in seconds) to s in the format
25//     ss  or  mm:ss  or  hh:mm:ss,
26// where the value t is first rounded to the nearest integer.
27
28void Error(const char *s);
29// print an error message and call abort
30
31long SkipWhiteSpace(istream& s);
32// skips white space (blanks, tabs, newlines).
33// Return value is 0 if end-of-file is reached; otherwise,
34// return value is 1.
35
36// This routine is useful in conjuction with input routines,
37// like NTL's, that raise an error if an input item is
38// ill-formed or missing. 
39
40long IsFinite(double *p);
41// Returns 1 if *p is a "finite" floating point number.
42// A pointer is used to ensure that the number is in memory,
43// which on some architectures (notably x86/Pentium) can make a difference.
44
45// some min/max and swap routines:
46
47int min(int a, int b);
48int max(int a, int b);
49
50long min(long a, long b);
51long max(long a, long b);
52
53long min(int a, long b);
54long max(int a, long b);
55
56long min(long a, int b);
57long max(long a, int b);
58
59void swap(long& a, long& b);
60void swap(int& a, int& b);
61
62
63// defined here are all the conversion routines among the types
64// int, long, float, double.  See conversions.txt for complete details.
65
66
67// The following platform-dependent macros are defined:
68
69#define NTL_BITS_PER_LONG      (...)  /* bits in a long */
70#define NTL_MAX_LONG           (...)  /* max value of a long */
71#define NTL_MIN_LONG           (...)  /* min value of a long */
72
73#define NTL_BITS_PER_INT       (...)  /* bits in a int */
74#define NTL_MAX_INT            (...)  /* max value of a int */
75#define NTL_MIN_INT            (...)  /* min value of a int */
76
77#define NTL_DOUBLE_PRECISION   (...)  /* # of bits of precision in a double */
78#define NTL_FDOUBLE_PRECISION  (...)  /* the double value
79                                        2^{NTL_DOUBLE_PRECISION-1} */
80
81#define NTL_ARITH_RIGHT_SHIFT  (...)  /* 1 if signed right-shift is
82                                        arithmetic; 0 otherwise */
83
84#define NTL_EXT_DOUBLE         (...)  /* 1 if platform has "extended" doubles;
85                                        0 otherwise */
86
Note: See TracBrowser for help on using the repository browser.