There are three standard arithmetic Particle classes: IntParticle, FloatParticle, and ComplexParticle. As their names suggest, each class adds to Particle a private data member of type int, double (not float!), and class Complex, respectively. When a casting operator or "<<" operator is used on a particle of one of these types, a type conversion may take place. If the type of the argument of cast matches the type of the particle's data, the data is simply copied. If the requested operation involves a "widening" conversion (int to float, double, or Complex; float to double or Complex; double to Complex), the "obvious" thing happens. Conversion from double to int rounds to the nearest integer; conversion from Complex to double returns the absolute value (not the real part!), and Complex to int returns the absolute value, rounded to the nearest integer. initialize
for each of these classes sets the data value to zero (for the appropriate domain). The DataTypes returned by these Particle types are the global symbols INT, FLOAT, and COMPLEX, respectively. They have the string values "INT", "FLOAT", and "COMPLEX".
Copyright © 1990-1997, University of California. All rights
reserved.