WWC snapshot of http://www.alw.nih.gov/Docs/NIHCL/nihcl_14.html taken on Sat Jun 10 19:13:41 1995

Go to the previous, next section.

Float--Floating Point Number

SYNOPSIS

#include <nihcl/Float.h>

BASE CLASS

Object

DERIVED CLASSES

None

RELATED CLASSES

None

DESCRIPTION

Class Float provides an NIH Class Library object to hold a floating point number. This is useful, for example, if one wishes to associate a key object with a floating point number and store it in a Dictionary. Arithmetic operations on Float objects have not been provided to discourage their use, due to their relative inefficiency.

CONSTRUCTORS

Float(double value =0)
Constructs an instance of class Float with the value value.

Float(istream& strm)
Constructs an instance of class Float with the value read from the input stream strm with istream::operator>>().

ACCESSING FLOATS

double value() const
Returns the value of this Float.

double value(double newValue)
Sets this Float to newValue and returns newValue.

SEARCHING

virtual unsigned hash() const
Returns a number suitable for use as a hash table probe.

COMPARING FLOATS

virtual int compare(const Object& ob) const
Compares this Float with the argument object ob, which must also be an instance of class Float. Returns a negative result if this Float is less than ob, zero if this Float equals ob, and a positive result if this Float is greater than ob.

TESTING FLOATS

virtual bool isEqual(const Object& ob) const
Returns YES if ob is of species Float and equals this Float.

COPYING FLOATS

virtual void deepenShallowCopy()
This function is a no-op for class Float.

READING AND PRINTING FLOATS

virtual void printOn(ostream& strm =cout) const
Prints this Float on output stream strm using ostream::operator<<().

virtual void scanFrom(istream& strm)
Assigns the value of this Float to the value obtained by reading the input stream strm with istream::operator>>().

FLOAT SPECIES

virtual const Class* species() const
Returns a pointer to the class descriptor for class Float.

PROTECTED MEMBERS

Object I/O

virtual void storer(OIOofd& fd) const
virtual void storer(OIOout& strm) const
Stores this Float on fd or strm.

EXCEPTIONS RAISED

None

Go to the previous, next section.