YCPFloatRep Class Reference

YCPValueRep representing a floating point number. The precision of the floating point number a YCPFloatRep is representing is not specified, because it would be very difficult to guarantee a certain precision platform independently and because this is not neccessary. More...

#include <YCPFloat.h>

Inheritance diagram for YCPFloatRep:
YCPValueRep YCPElementRep

List of all members.

Public Member Functions

double value () const
YCPOrder compare (const YCPFloat &v) const
string toString () const
std::ostream & toStream (std::ostream &str) const
std::ostream & toXml (std::ostream &str, int indent) const
YCPValueType valuetype () const

Protected Member Functions

 YCPFloatRep (double v)
 YCPFloatRep (const char *r)

Private Attributes

double v

Friends

class YCPFloat

Detailed Description

YCPValueRep representing a floating point number. The precision of the floating point number a YCPFloatRep is representing is not specified, because it would be very difficult to guarantee a certain precision platform independently and because this is not neccessary.

YCP Syntax: Like in C. The decimal point is obligatory.

1.0, -0.6, 0.9e-16, ...

Constructor & Destructor Documentation

YCPFloatRep::YCPFloatRep ( double  v  )  [protected]

Creates a new YCPFloatRep object with the value given in v.

YCPFloatRep::YCPFloatRep ( const char *  r  )  [protected]

Creates a new YCPFloatRep object from its ASCII representation

Parameters:
r string like '18.8e-17'

References v.


Member Function Documentation

YCPOrder YCPFloatRep::compare ( const YCPFloat v  )  const

Compares two YCPFloats for equality, greaterness or smallerness.

Parameters:
v value to compare against
Returns:
YO_LESS, if this is smaller than v, YO_EQUAL, if this is equal to v, YO_GREATER, if this is greater to v

References v, YO_EQUAL, YO_GREATER, and YO_LESS.

std::ostream & YCPFloatRep::toStream ( std::ostream &  str  )  const [virtual]

Output value as bytecode to stream

Implements YCPElementRep.

References toString(), and Bytecode::writeString().

string YCPFloatRep::toString ( void   )  const [virtual]

Returns an ASCII representation of this value. Note that this must alway contain either a decimal point, or an exponent symbol in order to keep up the axiom, that the syntactical representation of a YCP value uniquely describes its type. Examples: 0.0, 1e10, -17.0e8

Implements YCPElementRep.

References v.

Referenced by toStream(), and toXml().

std::ostream & YCPFloatRep::toXml ( std::ostream &  str,
int  indent 
) const [virtual]

Implements YCPValueRep.

References toString().

double YCPFloatRep::value (  )  const

Returns the value of this object in form of a C value of type double.

References v.

YCPValueType YCPFloatRep::valuetype (  )  const [virtual]

Returns YT_FLOAT. See YCPValueRep::type.

Implements YCPValueRep.

References YT_FLOAT.


Friends And Related Function Documentation

friend class YCPFloat [friend]

Member Data Documentation

double YCPFloatRep::v [private]

Referenced by compare(), toString(), value(), and YCPFloatRep().


The documentation for this class was generated from the following files:

Generated on a sunny day for yast2-core by doxygen 1.6.3